98 lines
2.3 KiB
PHP
98 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Traits\CreatedUpdatedBy;
|
|
|
|
class Registrations extends Model
|
|
{
|
|
use HasFactory, CreatedUpdatedBy;
|
|
|
|
protected $primaryKey = 'registration_id';
|
|
public $timestamps = true;
|
|
protected $fillable = [
|
|
'campaigns_id',
|
|
'sources_id',
|
|
'countries_id',
|
|
'provinces_id',
|
|
'districts_id',
|
|
'cities_id',
|
|
'leadcategories_id',
|
|
'agents_id',
|
|
'name',
|
|
'email',
|
|
'phone',
|
|
'mobile',
|
|
'address',
|
|
'qualifications_id',
|
|
'see_year',
|
|
'see_grade',
|
|
'see_stream',
|
|
'see_school',
|
|
'plus2_year',
|
|
'plus2_grade',
|
|
'plus2_stream',
|
|
'plus2_college',
|
|
'bachelors_year',
|
|
'bachelors_grade',
|
|
'bachelors_stream',
|
|
'bachelors_college',
|
|
'highest_qualification',
|
|
'highest_grade',
|
|
'highest_stream',
|
|
'highest_college',
|
|
'highest_year',
|
|
'preparation_class',
|
|
'preparation_score',
|
|
'preparation_bandscore',
|
|
'preparation_date',
|
|
'preffered_location',
|
|
'intrested_for_country',
|
|
'intrested_course',
|
|
'user_agent',
|
|
'tags',
|
|
'coupen_code',
|
|
'display_order',
|
|
'status',
|
|
'remarks',
|
|
'created_at',
|
|
'createdby',
|
|
'updated_at',
|
|
'updatedby',
|
|
'marital_status',
|
|
'experience',
|
|
'reference',
|
|
'how_you_know',
|
|
'gender',
|
|
'dob',
|
|
'guardian_name',
|
|
'applied_before'
|
|
|
|
];
|
|
|
|
protected $appends = ['status_name'];
|
|
|
|
protected function getStatusNameAttribute()
|
|
{
|
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
|
}
|
|
|
|
protected function createdBy(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
|
);
|
|
}
|
|
|
|
protected function updatedBy(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
|
);
|
|
}
|
|
}
|