This commit is contained in:
tanch0
2024-06-18 16:26:58 +05:45
parent 613dfd1834
commit 50b8768a34
68 changed files with 1540 additions and 657 deletions

View File

@ -8,26 +8,19 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Traits\CreatedUpdatedBy;
class Advertisement extends Model
class Adcategories extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'advertisement_id';
protected $table = 'advertisement';
protected $primaryKey = 'category_id';
public $timestamps = true;
protected $fillable = [
'title',
'parent_id',
'alias',
'description',
'image',
'video',
'link',
'display_order',
'status',
'remarks',
'created_by',
'updated_by',
'display_order',
'createdBy',
'updatedBy',
'created_at',
'updated_at',

View File

@ -0,0 +1,53 @@
<?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 Advertisements extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'advertisement_id';
public $timestamps = true;
protected $fillable =[
'title',
'section',
'alias',
'parent_advertisement',
'thumb',
'link',
'display_order',
'status',
'remarks',
'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 : '',
);
}
}

View File

@ -19,6 +19,7 @@ class Videos extends Model
'video_url',
'image',
'alias',
'description',
'status',
'display_order',
'createdBy',