This commit is contained in:
tanch0
2024-06-21 13:29:04 +05:45
parent 5b3c44aa33
commit 25760ad989
50 changed files with 1180 additions and 111 deletions

View File

@ -18,6 +18,7 @@ class Advertisements extends Model
'title',
'ad_categories_id',
'alias',
'valid_till',
'parent_advertisement',
'thumb',
'link',

View File

@ -31,6 +31,7 @@ class News extends Model
'image',
'thumb',
'image_source',
'views_count',
'display_order',
'status',
'remarks',

51
app/Models/Popups.php Normal file
View File

@ -0,0 +1,51 @@
<?php
namespace App\Models;
use App\Models\User;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\CreatedUpdatedBy;
class Popups extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'id';
public $timestamps = true;
protected $fillable =[
'title',
'description',
'image',
'valid_till',
'link',
'status',
'display_order',
'createdBy',
'updatedBy',
'created_at',
'updated_at',
];
protected $appends = ['status_name'];
protected function getStatusNameAttribute()
{
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
}
protected function createdBy(): Attribute
{
return Attribute::make(
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
);
}
protected function updatedBy(): Attribute
{
return Attribute::make(
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
);
}
}