| @@ 8-92 (lines=85) @@ | ||
| 5 | use Illuminate\Database\Eloquent\Model; |
|
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 7 | ||
| 8 | class Link extends Model |
|
| 9 | { |
|
| 10 | use SoftDeletes; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * The table associated with the model. |
|
| 14 | * |
|
| 15 | * @var string |
|
| 16 | */ |
|
| 17 | protected $table = 'links'; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * The attributes that should be mutated to dates. |
|
| 21 | * |
|
| 22 | * @var array |
|
| 23 | */ |
|
| 24 | protected $dates = ['deleted_at']; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * The attributes that are mass assignable. |
|
| 28 | * |
|
| 29 | * @var array |
|
| 30 | */ |
|
| 31 | protected $fillable = ['name', 'text', 'url', 'order']; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * A link belongs to a single project. |
|
| 35 | * |
|
| 36 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
| 37 | */ |
|
| 38 | public function project() |
|
| 39 | { |
|
| 40 | return $this->belongsTo(Project::class); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Return the link id. |
|
| 45 | * |
|
| 46 | * @return int |
|
| 47 | */ |
|
| 48 | public function id() |
|
| 49 | { |
|
| 50 | return $this->id; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Return the link name. |
|
| 55 | * |
|
| 56 | * @return string |
|
| 57 | */ |
|
| 58 | public function name() |
|
| 59 | { |
|
| 60 | return $this->name; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Return the link text. |
|
| 65 | * |
|
| 66 | * @return string |
|
| 67 | */ |
|
| 68 | public function text() |
|
| 69 | { |
|
| 70 | return $this->text; |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Return the link url. |
|
| 75 | * |
|
| 76 | * @return string |
|
| 77 | */ |
|
| 78 | public function url() |
|
| 79 | { |
|
| 80 | return $this->url; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Return the link order value. |
|
| 85 | * |
|
| 86 | * @return int |
|
| 87 | */ |
|
| 88 | public function order() |
|
| 89 | { |
|
| 90 | return $this->order; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||
| @@ 8-92 (lines=85) @@ | ||
| 5 | use Illuminate\Database\Eloquent\Model; |
|
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
|
| 7 | ||
| 8 | class TextBlock extends Model |
|
| 9 | { |
|
| 10 | use SoftDeletes; |
|
| 11 | ||
| 12 | /** |
|
| 13 | * The table associated with the model. |
|
| 14 | * |
|
| 15 | * @var string |
|
| 16 | */ |
|
| 17 | protected $table = 'text_blocks'; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * The attributes that should be mutated to dates. |
|
| 21 | * |
|
| 22 | * @var array |
|
| 23 | */ |
|
| 24 | protected $dates = ['deleted_at']; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * The attributes that are mass assignable. |
|
| 28 | * |
|
| 29 | * @var array |
|
| 30 | */ |
|
| 31 | protected $fillable = ['name', 'text', 'formatted_text', 'order']; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * A text block belongs to a single project. |
|
| 35 | * |
|
| 36 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
| 37 | */ |
|
| 38 | public function project() |
|
| 39 | { |
|
| 40 | return $this->belongsTo(Project::class); |
|
| 41 | } |
|
| 42 | ||
| 43 | /** |
|
| 44 | * Return the text block id. |
|
| 45 | * |
|
| 46 | * @return int |
|
| 47 | */ |
|
| 48 | public function id() |
|
| 49 | { |
|
| 50 | return $this->id; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * Return the text block name. |
|
| 55 | * |
|
| 56 | * @return string |
|
| 57 | */ |
|
| 58 | public function name() |
|
| 59 | { |
|
| 60 | return $this->name; |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * Return the raw block text. |
|
| 65 | * |
|
| 66 | * @return string |
|
| 67 | */ |
|
| 68 | public function text() |
|
| 69 | { |
|
| 70 | return $this->text; |
|
| 71 | } |
|
| 72 | ||
| 73 | /** |
|
| 74 | * Return the formatted block text. |
|
| 75 | * |
|
| 76 | * @return string |
|
| 77 | */ |
|
| 78 | public function formattedText() |
|
| 79 | { |
|
| 80 | return $this->formatted_text; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Return the text block order value. |
|
| 85 | * |
|
| 86 | * @return int |
|
| 87 | */ |
|
| 88 | public function order() |
|
| 89 | { |
|
| 90 | return $this->order; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||