Inital Commit

This commit is contained in:
tanch0
2024-05-05 10:32:49 +05:45
commit cc991bb0e1
7418 changed files with 507076 additions and 0 deletions

48
app/Models/Faqs/Faqs.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Models\Faqs;
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 Faqs extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'faq_id';
public $timestamps = true;
protected $fillable =[
'title',
'text',
'display_order',
'status',
'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 : '',
);
}
}