12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace App\Repositories\Models\Info;
- use App\Repositories\Models\Base\Admin;
- use App\Repositories\Models\Model;
- class News extends Model
- {
- /**
- * @var string
- */
- protected $table = 'info_news';
- protected $guarded = [];
- /**
- * The attributes excluded from the model's JSON form.
- *
- * @var array
- */
- protected $hidden = [];
- public function getCoverAttribute()
- {
- if (array_key_exists('cover_path', $this->attributes)) return path_to_url($this->attributes['cover_path']);
- return '';
- }
- public function admin()
- {
- return $this->belongsTo(Admin::class)->select(['id', 'name', 'username']);
- }
- }
|