migrate to gtea from bistbucket
This commit is contained in:
35
public/restaurant/Modules/Restaurant/app/Models/Addon.php
Normal file
35
public/restaurant/Modules/Restaurant/app/Models/Addon.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Addon extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'price',
|
||||
'vat',
|
||||
'pst',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'addons';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function foodItems(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(FoodItem::class, 'addon_food', 'addon_id', 'food_item_id')
|
||||
->using(AddonFood::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AddonFood extends Pivot
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'addon_id',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'addon_food';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function addon(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Addon::class);
|
||||
}
|
||||
|
||||
public function food(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class, 'food_item_id');
|
||||
}
|
||||
}
|
||||
82
public/restaurant/Modules/Restaurant/app/Models/Customer.php
Normal file
82
public/restaurant/Modules/Restaurant/app/Models/Customer.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Passport\HasApiTokens;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class Customer extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasRoles, Notifiable, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'customer_code',
|
||||
'name',
|
||||
'username',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'otp_code',
|
||||
'role_id',
|
||||
'isVerified',
|
||||
'email_verified_at',
|
||||
'avatar',
|
||||
'address',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'nid',
|
||||
'platform',
|
||||
'device_info',
|
||||
'last_active_time',
|
||||
'meta',
|
||||
'status',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'customers';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $guard_name = 'customer';
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'meta' => 'array',
|
||||
'last_active_time' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function role(): HasOne
|
||||
{
|
||||
return $this->hasOne(Role::class, 'id', 'role_id');
|
||||
}
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class CustomerAddress extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'label',
|
||||
'address_line_1',
|
||||
'address_line_2',
|
||||
'city',
|
||||
'postal_code',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'is_default',
|
||||
];
|
||||
|
||||
protected $casts = ['is_default' => 'boolean'];
|
||||
|
||||
public const TABLE_NAME = 'customer_addresses';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class DeliveryCharge extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'zone_id',
|
||||
'restaurant_id',
|
||||
'type',
|
||||
'base_charge',
|
||||
'per_km_charge',
|
||||
'min_order_amount',
|
||||
'free_delivery_above',
|
||||
'is_active',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'delivery_charges';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function zone(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Zone::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FoodAvailability extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'day',
|
||||
'is_available',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_availabilities';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function foodItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class, 'food_item_id');
|
||||
}
|
||||
|
||||
public function times(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodAvailabilityTime::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FoodAvailabilityTime extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_availability_id',
|
||||
'open_time',
|
||||
'close_time',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_availability_times';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function availability(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodAvailability::class, 'food_availability_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FoodCategory extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'slug',
|
||||
'image',
|
||||
'parent_id',
|
||||
'is_offer',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_categories';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function parent(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodCategory::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function children(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodCategory::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function foodItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodItem::class, 'category_id');
|
||||
}
|
||||
}
|
||||
102
public/restaurant/Modules/Restaurant/app/Models/FoodItem.php
Normal file
102
public/restaurant/Modules/Restaurant/app/Models/FoodItem.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Customer\Models\Review;
|
||||
|
||||
class FoodItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'category_id',
|
||||
'menu_category_id',
|
||||
'menu_section_id',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'food_type',
|
||||
'points',
|
||||
'is_featured',
|
||||
'is_party',
|
||||
'is_dinner',
|
||||
'is_lunch',
|
||||
'is_popular_item',
|
||||
'is_chef_special',
|
||||
'image',
|
||||
'prep_time',
|
||||
'cooking_time',
|
||||
'vat',
|
||||
'pst',
|
||||
'ingredients_cost',
|
||||
'allergens',
|
||||
'notes',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_items';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodCategory::class, 'category_id')->select('id', 'name');
|
||||
}
|
||||
|
||||
public function menuCategory(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MenuCategory::class)->select('id', 'name');
|
||||
}
|
||||
|
||||
public function menuSection(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MenuSection::class)->select('id', 'name');
|
||||
}
|
||||
|
||||
public function variants(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodVariant::class, 'food_item_id')->with('unit');
|
||||
}
|
||||
|
||||
public function defaultVariant(): HasOne
|
||||
{
|
||||
return $this->hasOne(FoodVariant::class, 'food_item_id')->with('unit')->where('is_default', true);
|
||||
}
|
||||
|
||||
public function availabilities(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodAvailability::class, 'food_item_id');
|
||||
}
|
||||
|
||||
public function addons(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Addon::class, 'addon_food', 'food_item_id', 'addon_id')
|
||||
->using(AddonFood::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function reviews(): HasMany
|
||||
{
|
||||
return $this->hasMany(Review::class, 'food_item_id')->with('images');
|
||||
}
|
||||
|
||||
public function scopeChefSpecial($query, int $value): mixed
|
||||
{
|
||||
return $query->where('is_chef_special', $value);
|
||||
}
|
||||
|
||||
public function scopePopular($query, int $value): mixed
|
||||
{
|
||||
return $query->where('is_popular_item', $value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class FoodReview extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'customer_id',
|
||||
'rating',
|
||||
'review',
|
||||
'images',
|
||||
'video_url',
|
||||
'video_file',
|
||||
'status',
|
||||
'is_featured',
|
||||
'position',
|
||||
'helpful_count',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'images' => 'array',
|
||||
'is_featured' => 'boolean',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_reviews';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function replies(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodReviewReply::class, 'review_id');
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class FoodReviewReply extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'review_id',
|
||||
'user_id',
|
||||
'customer_id',
|
||||
'user_type',
|
||||
'message',
|
||||
'attachments',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'attachments' => 'array',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_review_replies';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function review(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodReview::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FoodVariant extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'name',
|
||||
'sku',
|
||||
'barcode',
|
||||
'price',
|
||||
'offer_price',
|
||||
'discount',
|
||||
'unit_id',
|
||||
'image',
|
||||
'description',
|
||||
'is_default',
|
||||
'stock_tracking',
|
||||
'ingredients_cost',
|
||||
'profit_margin',
|
||||
'alert_stock_quantity',
|
||||
'combo_type',
|
||||
'is_active_offer',
|
||||
'offer_start_at',
|
||||
'offer_end_at',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_variants';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function food(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class, 'food_item_id');
|
||||
}
|
||||
|
||||
public static function getDefaultVariant($foodId): ?FoodVariant
|
||||
{
|
||||
return self::where('food_item_id', $foodId)->where('is_default', true)->first();
|
||||
}
|
||||
|
||||
public function ingredients(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodVariantIngredient::class, 'food_variant_id', 'id')
|
||||
->with('ingredient');
|
||||
}
|
||||
|
||||
public function unit(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Unit::class)->select('id', 'name', 'short_name');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class FoodVariantIngredient extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_variant_id',
|
||||
'ingredient_id',
|
||||
'quantity',
|
||||
'wastage_percentage',
|
||||
'unit_conversion_factor',
|
||||
'optional',
|
||||
'notes',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_variant_ingredients';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function variant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodVariant::class, 'food_variant_id');
|
||||
}
|
||||
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class, 'ingredient_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class FoodWaste extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'food_variant_id',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'reason',
|
||||
'notes',
|
||||
'wasted_by',
|
||||
'approved_by',
|
||||
'wasted_at',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'quantity' => 'decimal:2',
|
||||
'unit_cost' => 'decimal:2',
|
||||
'wasted_at' => 'datetime',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'food_wastes';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class);
|
||||
}
|
||||
|
||||
public function variation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodVariant::class, 'food_variant_id');
|
||||
}
|
||||
|
||||
public function wastedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'wasted_by');
|
||||
}
|
||||
|
||||
public function approvedByUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_by');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Ingredient extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'unit_id',
|
||||
'stock_quantity',
|
||||
'cost_per_unit',
|
||||
'low_stock_alert',
|
||||
'supplier_id',
|
||||
'last_purchase_price',
|
||||
'last_purchase_date',
|
||||
'conversion_factor',
|
||||
'reserved_quantity',
|
||||
'wastage_quantity',
|
||||
'category',
|
||||
'notes',
|
||||
'status',
|
||||
'image',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'ingredients';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function foodVariants(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(FoodVariant::class, 'food_variant_ingredients')
|
||||
->withPivot(['quantity', 'wastage_percentage', 'unit_conversion_factor', 'optional', 'notes'])
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
public function purchaseItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(PurchaseItem::class);
|
||||
}
|
||||
|
||||
public function stock(): HasMany
|
||||
{
|
||||
return $this->hasMany(Stock::class);
|
||||
}
|
||||
|
||||
public function damages(): HasMany
|
||||
{
|
||||
return $this->hasMany(IngredientDamage::class);
|
||||
}
|
||||
|
||||
public function unit(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Unit::class)->select('id', 'name', 'short_name');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class IngredientDamage extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'ingredient_id',
|
||||
'batch_no',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'total_cost',
|
||||
'reason',
|
||||
'damage_date',
|
||||
'reported_by',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'ingredient_damages';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $dates = ['damage_date', 'created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class, 'ingredient_id');
|
||||
}
|
||||
|
||||
public function reportedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'reported_by');
|
||||
}
|
||||
}
|
||||
22
public/restaurant/Modules/Restaurant/app/Models/Kitchen.php
Normal file
22
public/restaurant/Modules/Restaurant/app/Models/Kitchen.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Kitchen extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'serial',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'kitchens';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class KitchenAssign extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'kitchen_id',
|
||||
'user_id',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'kitchen_assigns';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class LoyaltyPoint extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'order_id',
|
||||
'food_item_id',
|
||||
'points',
|
||||
'type',
|
||||
'reason',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'loyalty_points';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function user(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function foodItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class);
|
||||
}
|
||||
|
||||
public function order(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class LoyaltyPointSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'from_amount',
|
||||
'to_amount',
|
||||
'amount',
|
||||
'earn_point',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'loyalty_point_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
class LoyaltyRedemption extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'food_item_id',
|
||||
'points_used',
|
||||
'price',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'loyalty_redemptions';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function user(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function foodItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class MenuCategory extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'slug',
|
||||
'icon',
|
||||
'description',
|
||||
'priority',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'menu_categories';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function menuSections(): HasMany
|
||||
{
|
||||
return $this->hasMany(MenuSection::class);
|
||||
}
|
||||
|
||||
public function foodItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodItem::class)->with('variants', 'defaultVariant');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class MenuSection extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'menu_category_id',
|
||||
'name',
|
||||
'slug',
|
||||
'description',
|
||||
'priority',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'menu_sections';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function menuCategory(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(MenuCategory::class);
|
||||
}
|
||||
|
||||
public function foodItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(FoodItem::class);
|
||||
}
|
||||
}
|
||||
29
public/restaurant/Modules/Restaurant/app/Models/MenuType.php
Normal file
29
public/restaurant/Modules/Restaurant/app/Models/MenuType.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class MenuType extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'slug',
|
||||
'icon',
|
||||
'description',
|
||||
'display_order',
|
||||
'status',
|
||||
'is_default',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'menu_types';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
87
public/restaurant/Modules/Restaurant/app/Models/Order.php
Normal file
87
public/restaurant/Modules/Restaurant/app/Models/Order.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Order extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'table_id',
|
||||
'waiter_id',
|
||||
'driver_id',
|
||||
'customer_id',
|
||||
'payment_method_id',
|
||||
'order_number',
|
||||
'reference',
|
||||
'order_type',
|
||||
'status',
|
||||
'subtotal',
|
||||
'discount',
|
||||
'tax',
|
||||
'service_charge',
|
||||
'tip_amount',
|
||||
'grand_total',
|
||||
'payment_status',
|
||||
'payment_reference',
|
||||
'paid_at',
|
||||
'order_date',
|
||||
'preparation_time',
|
||||
'ready_at',
|
||||
'handed_over_at',
|
||||
'delivered_at',
|
||||
'estimated_ready_time',
|
||||
'delivery_address',
|
||||
'order_source',
|
||||
'meta',
|
||||
'added_by',
|
||||
'cancelled_at',
|
||||
'cancel_reason',
|
||||
'cancelled_by',
|
||||
'updated_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'orders';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'payment_status' => 'boolean',
|
||||
'meta' => 'array',
|
||||
];
|
||||
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(OrderItem::class)->with('food');
|
||||
}
|
||||
|
||||
public function table(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Table::class);
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function waiter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'waiter_id');
|
||||
}
|
||||
|
||||
public function paymentMethod(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PaymentMethod::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class OrderItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'order_id',
|
||||
'restaurant_id',
|
||||
'food_item_id',
|
||||
'food_variant_id',
|
||||
'quantity',
|
||||
'price',
|
||||
'discount',
|
||||
'tax',
|
||||
'total',
|
||||
'addons',
|
||||
'meta',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'order_items';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'addons' => 'array',
|
||||
'meta' => 'array',
|
||||
];
|
||||
|
||||
public function order(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
|
||||
public function food(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodItem::class, 'food_item_id');
|
||||
}
|
||||
|
||||
public function variation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodVariant::class, 'food_variant_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use App\Enum\TrackingStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class OrderTracking extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'order_id',
|
||||
'delivery_boy_id',
|
||||
'status',
|
||||
'latitude',
|
||||
'longitude',
|
||||
'location_name',
|
||||
'note',
|
||||
'tracked_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'tracked_at' => 'datetime',
|
||||
'status' => TrackingStatus::class,
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'order_trackings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function order(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Order::class);
|
||||
}
|
||||
|
||||
public function deliveryBoy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'delivery_boy_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PaymentMethod extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'type',
|
||||
'credentials',
|
||||
'is_default',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'payment_methods';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'credentials' => 'array',
|
||||
];
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
}
|
||||
}
|
||||
58
public/restaurant/Modules/Restaurant/app/Models/Purchase.php
Normal file
58
public/restaurant/Modules/Restaurant/app/Models/Purchase.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Purchase extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'supplier_id',
|
||||
'invoice_no',
|
||||
'purchase_date',
|
||||
'sub_total',
|
||||
'discount_amount',
|
||||
'tax_amount',
|
||||
'total_amount',
|
||||
'payment_status',
|
||||
'payment_method',
|
||||
'purchase_type',
|
||||
'created_by',
|
||||
'notes',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'purchases';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'purchase_date' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
// 🔗 Relationships
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(PurchaseItem::class, 'purchase_id');
|
||||
}
|
||||
|
||||
public function supplier(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Supplier::class, 'supplier_id');
|
||||
}
|
||||
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PurchaseItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'purchase_id',
|
||||
'ingredient_id',
|
||||
'food_variant_id',
|
||||
'quantity',
|
||||
'unit_price',
|
||||
'total_cost',
|
||||
'tax_amount',
|
||||
'discount_amount',
|
||||
'batch_no',
|
||||
'expiry_date',
|
||||
'received_quantity',
|
||||
'wastage_quantity',
|
||||
'returned_quantity',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'purchase_items';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'expiry_date' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
// 🔗 Relationships
|
||||
public function purchase(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Purchase::class, 'purchase_id');
|
||||
}
|
||||
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class, 'ingredient_id')->with('unit');
|
||||
}
|
||||
|
||||
public function variant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(FoodVariant::class, 'food_variant_id');
|
||||
}
|
||||
|
||||
public function returns(): HasMany
|
||||
{
|
||||
return $this->hasMany(PurchaseReturn::class, 'purchase_item_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class PurchaseReturn extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'purchase_id',
|
||||
'purchase_item_id',
|
||||
'ingredient_id',
|
||||
'batch_no',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'total_cost',
|
||||
'reason',
|
||||
'return_date',
|
||||
'processed_by',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'purchase_returns';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $dates = ['damage_date', 'created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
public function purchase(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Purchase::class);
|
||||
}
|
||||
|
||||
public function purchaseItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PurchaseItem::class);
|
||||
}
|
||||
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class);
|
||||
}
|
||||
|
||||
public function processedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'processed_by');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class QRMenuSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'menu_title',
|
||||
'logo',
|
||||
'menu_url',
|
||||
'primary_color',
|
||||
'secondary_color',
|
||||
'bg_color',
|
||||
'template',
|
||||
'description',
|
||||
'qr_code_url',
|
||||
'wifi_name',
|
||||
'wifi_ssid',
|
||||
'wifi_password',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'q_r_menu_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Reservation extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'table_id',
|
||||
'customer_id',
|
||||
'people_count',
|
||||
'reservation_date',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'status',
|
||||
'note',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'reservations';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'reservation_date' => 'date',
|
||||
'start_time' => 'datetime:H:i',
|
||||
'end_time' => 'datetime:H:i',
|
||||
];
|
||||
|
||||
public function table(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Table::class);
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ReservationSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'max_reservation',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'reservation_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ReservationUnavailable extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'table_id',
|
||||
'date',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'reason',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'reservation_unavailables';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function table(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Table::class)->select('id', 'name');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class RestaurantSchedule extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'day',
|
||||
'is_open',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'restaurant_schedules';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function times(): HasMany
|
||||
{
|
||||
return $this->hasMany(RestaurantScheduleTime::class, 'restaurant_schedule_id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class RestaurantScheduleTime extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'restaurant_schedule_id',
|
||||
'open_time',
|
||||
'close_time',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'restaurant_schedule_times';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function schedule(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(RestaurantSchedule::class, 'restaurant_schedule_id');
|
||||
}
|
||||
}
|
||||
56
public/restaurant/Modules/Restaurant/app/Models/Stock.php
Normal file
56
public/restaurant/Modules/Restaurant/app/Models/Stock.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Stock extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'ingredient_id',
|
||||
'type',
|
||||
'quantity',
|
||||
'unit_cost',
|
||||
'total_cost',
|
||||
'reference_type',
|
||||
'purchase_id',
|
||||
'batch_no',
|
||||
'expiry_date',
|
||||
'added_by',
|
||||
'remarks',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'stocks';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
protected $casts = [
|
||||
'expiry_date' => 'date:Y-m-d',
|
||||
];
|
||||
|
||||
// 🔗 Relationships
|
||||
public function ingredient(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Ingredient::class);
|
||||
}
|
||||
|
||||
public function purchaseItem(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PurchaseItem::class, 'purchase_id');
|
||||
}
|
||||
|
||||
public function addedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'added_by');
|
||||
}
|
||||
}
|
||||
53
public/restaurant/Modules/Restaurant/app/Models/Supplier.php
Normal file
53
public/restaurant/Modules/Restaurant/app/Models/Supplier.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Supplier extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'phone',
|
||||
'company_name',
|
||||
'contact_person',
|
||||
'alternate_phone',
|
||||
'email',
|
||||
'website',
|
||||
'image',
|
||||
'address',
|
||||
'city',
|
||||
'state',
|
||||
'country',
|
||||
'postal_code',
|
||||
'tax_number',
|
||||
'bank_name',
|
||||
'bank_account_name',
|
||||
'bank_account_number',
|
||||
'ifsc_code',
|
||||
'opening_balance',
|
||||
'opening_balance_date',
|
||||
'due',
|
||||
'balance',
|
||||
'supply_type',
|
||||
'payment_terms',
|
||||
'credit_limit',
|
||||
'rating',
|
||||
'notes',
|
||||
'contract_file',
|
||||
'trade_license',
|
||||
'nid_number',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'suppliers';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
47
public/restaurant/Modules/Restaurant/app/Models/Table.php
Normal file
47
public/restaurant/Modules/Restaurant/app/Models/Table.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Table extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'serial',
|
||||
'section',
|
||||
'location',
|
||||
'table_type',
|
||||
'capacity',
|
||||
'is_bookable',
|
||||
'qr_code',
|
||||
'image',
|
||||
'position_x',
|
||||
'position_y',
|
||||
'rotation',
|
||||
'z_index',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'tables';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
}
|
||||
|
||||
public function reservations(): HasMany
|
||||
{
|
||||
return $this->hasMany(Reservation::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class TaxSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'reg_no',
|
||||
'type',
|
||||
'value',
|
||||
'is_default',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'tax_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
42
public/restaurant/Modules/Restaurant/app/Models/Unit.php
Normal file
42
public/restaurant/Modules/Restaurant/app/Models/Unit.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Unit extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'name',
|
||||
'short_name',
|
||||
'type',
|
||||
'base_unit_id',
|
||||
'operator',
|
||||
'operator_value',
|
||||
'priority',
|
||||
'version',
|
||||
'is_default',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'units';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function baseUnit(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Unit::class, 'base_unit_id');
|
||||
}
|
||||
|
||||
public function childUnits(): HasMany
|
||||
{
|
||||
return $this->hasMany(Unit::class, 'base_unit_id');
|
||||
}
|
||||
}
|
||||
38
public/restaurant/Modules/Restaurant/app/Models/Zone.php
Normal file
38
public/restaurant/Modules/Restaurant/app/Models/Zone.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Restaurant\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Modules\Authentication\Models\Restaurant;
|
||||
|
||||
class Zone extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'code',
|
||||
'description',
|
||||
'coordinates',
|
||||
'is_active',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = ['coordinates' => 'array', 'is_active' => 'boolean'];
|
||||
|
||||
public const TABLE_NAME = 'zones';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function restaurants(): HasMany
|
||||
{
|
||||
return $this->hasMany(Restaurant::class);
|
||||
}
|
||||
|
||||
public function deliveryCharges(): HasMany
|
||||
{
|
||||
return $this->hasMany(DeliveryCharge::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user