| @@ 20-96 (lines=77) @@ | ||
| 17 | use Illuminate\Database\Eloquent\Model; |
|
| 18 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 19 | ||
| 20 | class CommentStatus extends Model |
|
| 21 | { |
|
| 22 | use SoftDeletes, AdminModelTrait; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * The database table used by the model. |
|
| 26 | * |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | protected $table = 'commentstatus'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * The attributes that should be mutated to dates. |
|
| 33 | * |
|
| 34 | * @var array |
|
| 35 | */ |
|
| 36 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The attributes that are mass assignable. |
|
| 40 | * |
|
| 41 | * @var array |
|
| 42 | */ |
|
| 43 | protected $fillable = ['name', 'color']; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Columns to exclude from index |
|
| 47 | * |
|
| 48 | * @var array |
|
| 49 | */ |
|
| 50 | protected $excludedFromIndex = []; |
|
| 51 | ||
| 52 | /** |
|
| 53 | * Fields to search in fulltext mode |
|
| 54 | * |
|
| 55 | * @var array |
|
| 56 | */ |
|
| 57 | protected $fulltextFields = [ |
|
| 58 | 'id', |
|
| 59 | 'name' => [ |
|
| 60 | 'operator' => 'LIKE', |
|
| 61 | 'prefix' => '%', |
|
| 62 | 'sufix' => '%' |
|
| 63 | ], |
|
| 64 | ||
| 65 | ]; |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Default order by |
|
| 69 | * |
|
| 70 | * @var array |
|
| 71 | */ |
|
| 72 | protected $defaultOrderBy = [ |
|
| 73 | 'name' => 'asc' |
|
| 74 | ]; |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Image link |
|
| 78 | * |
|
| 79 | * @return object |
|
| 80 | */ |
|
| 81 | public function comments(){ |
|
| 82 | ||
| 83 | return $this->hasMany('App\Comment', 'commentstatus_id'); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * Process relationships |
|
| 88 | * |
|
| 89 | * @param query $query |
|
| 90 | * @return query |
|
| 91 | */ |
|
| 92 | public function scopeRelationships($query){ |
|
| 93 | ||
| 94 | return $query->with('comments'); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| @@ 20-88 (lines=69) @@ | ||
| 17 | use Illuminate\Database\Eloquent\Model; |
|
| 18 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 19 | ||
| 20 | class Usergroup extends Model |
|
| 21 | { |
|
| 22 | use SoftDeletes, AdminModelTrait; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * The database table used by the model. |
|
| 26 | * |
|
| 27 | * @var string |
|
| 28 | */ |
|
| 29 | protected $table = 'usergroup'; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * The attributes that should be mutated to dates. |
|
| 33 | * |
|
| 34 | * @var array |
|
| 35 | */ |
|
| 36 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The attributes that are mass assignable. |
|
| 40 | * |
|
| 41 | * @var array |
|
| 42 | */ |
|
| 43 | protected $fillable = ['name']; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Fields to search in fulltext mode |
|
| 47 | * |
|
| 48 | * @var array |
|
| 49 | */ |
|
| 50 | protected $fulltextFields = [ |
|
| 51 | 'id', |
|
| 52 | 'name' => [ |
|
| 53 | 'operator' => 'LIKE', |
|
| 54 | 'prefix' => '%', |
|
| 55 | 'sufix' => '%' |
|
| 56 | ], |
|
| 57 | ]; |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Default order by |
|
| 61 | * |
|
| 62 | * @var array |
|
| 63 | */ |
|
| 64 | protected $defaultOrderBy = [ |
|
| 65 | 'id' => 'desc' |
|
| 66 | ]; |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Slide link |
|
| 70 | * |
|
| 71 | * @return object |
|
| 72 | */ |
|
| 73 | public function users(){ |
|
| 74 | ||
| 75 | return $this->hasMany('App\User', 'usergroup_id'); |
|
| 76 | } |
|
| 77 | ||
| 78 | /** |
|
| 79 | * Process relationships |
|
| 80 | * |
|
| 81 | * @param query $query |
|
| 82 | * @return query |
|
| 83 | */ |
|
| 84 | public function scopeRelationships($query){ |
|
| 85 | ||
| 86 | return $query->with('users'); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||