first commit

This commit is contained in:
2025-11-06 06:55:15 +00:00
commit 0b603376d2
107 changed files with 17279 additions and 0 deletions

54
app/Models/Category.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
use HasFactory;
protected $fillable = [
'title',
'description',
'sortingIndex',
'isActive',
'thumbnail',
];
protected $casts = [
'title' => 'array',
'description' => 'array',
'isActive' => 'boolean',
];
public function getTitleAttribute($value)
{
$locale = app()->getLocale();
$titles = is_array($value) ? $value : json_decode($value, true);
return $titles[$locale] ?? $titles['en'] ?? '';
}
public function getDescriptionAttribute($value)
{
$locale = app()->getLocale();
$descriptions = is_array($value) ? $value : json_decode($value, true);
return $descriptions[$locale] ?? $descriptions['en'] ?? '';
}
public function setTitleAttribute($value)
{
$this->attributes['title'] = json_encode($value);
}
public function setDescriptionAttribute($value)
{
$this->attributes['description'] = json_encode($value);
}
public function menus()
{
return $this->hasMany(Menu::class);
}
}

57
app/Models/Menu.php Normal file
View File

@@ -0,0 +1,57 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
use HasFactory;
protected $fillable = [
'menu_id',
'title',
'description',
'price',
'image',
'isActive',
'category_id',
];
protected $casts = [
'menu_id' => 'integer',
'title' => 'array',
'description' => 'array',
'isActive' => 'boolean',
];
public function getTitleAttribute($value)
{
$locale = app()->getLocale();
$titles = is_array($value) ? $value : json_decode($value, true);
return $titles[$locale] ?? $titles['en'] ?? '';
}
public function getDescriptionAttribute($value)
{
$locale = app()->getLocale();
$descriptions = is_array($value) ? $value : json_decode($value, true);
return $descriptions[$locale] ?? $descriptions['en'] ?? '';
}
public function setTitleAttribute($value)
{
$this->attributes['title'] = json_encode($value);
}
public function setDescriptionAttribute($value)
{
$this->attributes['description'] = json_encode($value);
}
public function category()
{
return $this->belongsTo(Category::class);
}
}

11
app/Models/Setting.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Setting extends Model
{
use HasFactory;
}

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

@@ -0,0 +1,51 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'country_code',
'phone',
'password',
'image',
'how_hear_about_us'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}