Root Zanli
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
o5t6x7pgljbm
/
public_html
/
admin_new2
/
app
/
Models
/
Filename :
College.php
back
Copy
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Casts\Attribute; use Config; class College extends Model { use SoftDeletes; protected $table = 'colleges'; protected $primaryKey = 'college_id'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'college_name', 'college_image', 'description', 'tuition_fee', 'application_deadline', 'acceptance_rate', 'about_college', 'scholarship_points', 'sat_min_range', 'sat_max_range', 'act_min_range', 'act_max_range', 'high_school_gpa', 'median_salary', 'avarage_debt', 'graduation_rate', 'sp_per_week', 'is_ivy_league', 'ivy_league_badge', 'country_id', 'is_featured', 'created_at', 'updated_at', 'deleted_at' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'deleted_at' ]; protected function collegeImage(): Attribute { return Attribute::make( get: fn ($value) => $value == null ? Config::get('constants.app.api-college-image-url') . 'college_image_3.png' : Config::get('constants.app.api-college-image-url').$value, ); } public function images(): HasMany { return $this->hasMany('App\Models\CollegeImage', 'college_id'); } public function popularMajors(): HasMany { return $this->hasMany('App\Models\PopularMajor', 'college_id'); } public function collegeGoalWeightage(): HasMany { return $this->hasMany('App\Models\CollegeGoalWeightage', 'college_id'); } }