12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Repositories\Models\Dwbs;
- use App\Repositories\Models\Model;
- class BusinessSchool extends Model
- {
- /**
- * @var string
- */
- protected $table = 'dwbs_business_school';
- protected $guarded = [];
- /**
- * The attributes excluded from the model's JSON form.
- *
- * @var array
- */
- protected $hidden = [];
- protected $casts = [];
- public function category()
- {
- return $this->belongsTo(BusinessCategory::class, 'category_id')->select(['id', 'name']);
- }
- public function getCoverAttribute($val)
- {
- if (empty($val)) {
- return config('app.url') . '/default/headimg.png';
- }
- return path_to_url($val);
- }
- public function setCoverAttribute($val)
- {
- $this->attributes['cover'] = url_to_path($val);
- }
- public function getPathAttribute($val)
- {
- if (empty($val)) {
- return null;
- }
- return path_to_url($val);
- }
- public function setPathAttribute($val)
- {
- $this->attributes['path'] = url_to_path($val);
- }
- }
|