| Total Complexity | 4 |
| Total Lines | 102 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 8 | class Theme extends Model |
||
| 9 | { |
||
| 10 | use SoftDeletes; |
||
| 11 | const default = 1; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * The database table used by the model. |
||
| 15 | * |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | protected $table = 'themes'; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Indicates if the model should be timestamped. |
||
| 22 | * |
||
| 23 | * @var bool |
||
| 24 | */ |
||
| 25 | public $timestamps = true; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * The attributes that are not mass assignable. |
||
| 29 | * |
||
| 30 | * @var array |
||
| 31 | */ |
||
| 32 | protected $guarded = [ |
||
| 33 | 'id', |
||
| 34 | ]; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * The attributes that are hidden. |
||
| 38 | * |
||
| 39 | * @var array |
||
| 40 | */ |
||
| 41 | protected $hidden = []; |
||
| 42 | |||
| 43 | /** |
||
| 44 | * The attributes that should be mutated to dates. |
||
| 45 | * |
||
| 46 | * @var array |
||
| 47 | */ |
||
| 48 | protected $dates = [ |
||
| 49 | 'created_at', |
||
| 50 | 'updated_at', |
||
| 51 | 'deleted_at', |
||
| 52 | ]; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Fillable fields for a Profile. |
||
| 56 | * |
||
| 57 | * @var array |
||
| 58 | */ |
||
| 59 | protected $fillable = [ |
||
| 60 | 'name', |
||
| 61 | 'link', |
||
| 62 | 'notes', |
||
| 63 | 'status', |
||
| 64 | 'taggable_id', |
||
| 65 | 'taggable_type', |
||
| 66 | ]; |
||
| 67 | |||
| 68 | /** |
||
| 69 | * The attributes that should be cast to native types. |
||
| 70 | * |
||
| 71 | * @var array |
||
| 72 | */ |
||
| 73 | protected $casts = [ |
||
| 74 | 'id' => 'integer', |
||
| 75 | 'name' => 'string', |
||
| 76 | 'link' => 'string', |
||
| 77 | 'notes' => 'string', |
||
| 78 | 'status' => 'boolean', |
||
| 79 | 'activated' => 'boolean', |
||
| 80 | 'taggable_id' => 'integer', |
||
| 81 | 'taggable_type' => 'string', |
||
| 82 | ]; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Get a validator for an incoming registration request. |
||
| 86 | * |
||
| 87 | * @param array $data |
||
| 88 | * |
||
| 89 | * @return array |
||
| 90 | */ |
||
| 91 | public static function rules($id = 0, $merge = []) |
||
| 92 | { |
||
| 93 | return array_merge( |
||
| 94 | [ |
||
| 95 | 'name' => 'required|min:3|max:50|unique:themes,name'.($id ? ",$id" : ''), |
||
| 96 | 'link' => 'required|min:3|max:255|unique:themes,link'.($id ? ",$id" : ''), |
||
| 97 | 'notes' => 'max:500', |
||
| 98 | 'status' => 'required', |
||
| 99 | ], |
||
| 100 | $merge |
||
| 101 | ); |
||
| 102 | } |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Get the profiles for the theme. |
||
| 106 | */ |
||
| 107 | public function profile() |
||
| 110 | } |
||
| 111 | } |
||
| 112 |