first commit
This commit is contained in:
83
app/Models/Students.php
Normal file
83
app/Models/Students.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Traits\CreatedUpdatedBy;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Students extends Model
|
||||
{
|
||||
use HasFactory, CreatedUpdatedBy;
|
||||
|
||||
protected $primaryKey = 'student_id';
|
||||
public $timestamps = true;
|
||||
protected $fillable = [
|
||||
'campaigns_id',
|
||||
'sources_id',
|
||||
'leadcategories_id',
|
||||
'agents_id',
|
||||
'countries_id',
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'mobile',
|
||||
'address',
|
||||
'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',
|
||||
'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',
|
||||
|
||||
];
|
||||
|
||||
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 : '',
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user