Added CRUD routes for benefits, success stories, and visa grants

Landing registration page completed except design
This commit is contained in:
2025-07-08 17:53:06 +05:45
parent 71241f5167
commit 2339e48b28
29 changed files with 3722 additions and 926 deletions

51
app/Models/Benefits.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 Benefits extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'benefit_id';
public $timestamps = true;
protected $fillable =[
'display',
'title',
'text',
'extra_content',
'cover',
'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 : '',
);
}
}

View File

@ -11,17 +11,5 @@ class Enquiries extends Model
protected $primaryKey = 'enquiry_id';
public $timestamps = true;
protected $fillable = [
'name',
'phone',
'email',
'is_read',
'message',
'service_id',
];
public function service()
{
return $this->belongsTo(Services::class, 'service_id', 'service_id');
}
protected $guarded = [];
}

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 Success_stories extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'stories_id';
public $timestamps = true;
protected $fillable =[
'display',
'title',
'text',
'extra_content',
'cover',
'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 : '',
);
}
}

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 Visa_grants extends Model
{
use HasFactory, CreatedUpdatedBy;
protected $primaryKey = 'visa_id';
public $timestamps = true;
protected $fillable =[
'display',
'title',
'text',
'extra_content',
'cover',
'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 : '',
);
}
}