123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Ad extends Model
- {
- use SoftDeletes;
- protected $guarded = [''];
- public function getStartedAtAttribute($value)
- {
- if ($value>0) {
- return date('Y-m-d', $value);
- } else {
- return '';
- }
- }
- public function getEndedAtAttribute($value)
- {
- if ($value>0) {
- return date('Y-m-d', $value);
- } else {
- return '';
- }
- }
- public function show_category()
- {
- return $this->belongsTo(AdCategory::class, 'category_id');
- }
- public function subsites()
- {
- return $this->hasMany(SubsiteAd::class, 'ad_id');
- }
- }
|