migrate to gtea from bistbucket
This commit is contained in:
23
public/restaurant/Modules/Frontend/app/Models/AboutUs.php
Normal file
23
public/restaurant/Modules/Frontend/app/Models/AboutUs.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AboutUs extends Model
|
||||
{
|
||||
protected $table = 'about_us';
|
||||
|
||||
public const TABLE_NAME = 'about_us';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'description',
|
||||
'image',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AcademicImage extends Model
|
||||
{
|
||||
protected $table = 'academic_images';
|
||||
|
||||
public const TABLE_NAME = 'academic_images';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'heading',
|
||||
'description',
|
||||
'image',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
25
public/restaurant/Modules/Frontend/app/Models/Banner.php
Normal file
25
public/restaurant/Modules/Frontend/app/Models/Banner.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Banner extends Model
|
||||
{
|
||||
protected $table = 'banners';
|
||||
|
||||
public const TABLE_NAME = 'banners';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'description',
|
||||
'button_name',
|
||||
'button_link',
|
||||
'image',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
25
public/restaurant/Modules/Frontend/app/Models/CMSSection.php
Normal file
25
public/restaurant/Modules/Frontend/app/Models/CMSSection.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CMSSection extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'serial',
|
||||
'title',
|
||||
'description',
|
||||
'image',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'c_m_s_sections';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
24
public/restaurant/Modules/Frontend/app/Models/Contact.php
Normal file
24
public/restaurant/Modules/Frontend/app/Models/Contact.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Contact extends Model
|
||||
{
|
||||
protected $table = 'frontend_contacts';
|
||||
|
||||
public const TABLE_NAME = 'frontend_contacts';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'phone',
|
||||
'email',
|
||||
'subject',
|
||||
'message',
|
||||
];
|
||||
}
|
||||
84
public/restaurant/Modules/Frontend/app/Models/Coupon.php
Normal file
84
public/restaurant/Modules/Frontend/app/Models/Coupon.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Coupon extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'name',
|
||||
'added_by',
|
||||
'discount_type',
|
||||
'coupon_type',
|
||||
'amount',
|
||||
'valid_from',
|
||||
'valid_to',
|
||||
'usage_limit',
|
||||
'max_uses_per_customer',
|
||||
'min_order_amount',
|
||||
'image',
|
||||
'source',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'amount' => 'decimal:2',
|
||||
'min_order_amount' => 'decimal:2',
|
||||
'valid_from' => 'datetime',
|
||||
'valid_to' => 'datetime',
|
||||
'status' => 'integer',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'coupons';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function usages(): HasMany
|
||||
{
|
||||
return $this->hasMany(CouponUsage::class, 'coupon_id');
|
||||
}
|
||||
|
||||
// Scopes
|
||||
public function scopeActive($query): mixed
|
||||
{
|
||||
return $query->where('status', 1)
|
||||
->where(function ($q) {
|
||||
$q->whereNull('valid_from')->orWhere('valid_from', '<=', now());
|
||||
})
|
||||
->where(function ($q) {
|
||||
$q->whereNull('valid_to')->orWhere('valid_to', '>=', now());
|
||||
});
|
||||
}
|
||||
|
||||
// Helper: Calculate discount for an order
|
||||
public function calculateDiscount(float $orderTotal): float
|
||||
{
|
||||
if ($this->discount_type === 'fixed') {
|
||||
return min($this->amount, $orderTotal);
|
||||
}
|
||||
|
||||
if ($this->discount_type === 'percentage') {
|
||||
return round($orderTotal * ($this->amount / 100), 2);
|
||||
}
|
||||
|
||||
if ($this->discount_type === 'free_delivery') {
|
||||
return 0; // discount only applies to delivery
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CouponUsage extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'coupon_id',
|
||||
'customer_id',
|
||||
'order_id',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'coupon_usages';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class FaqQuestion extends Model
|
||||
{
|
||||
protected $table = 'faq_questions';
|
||||
|
||||
public const TABLE_NAME = 'faq_questions';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'question',
|
||||
'answer',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class MobileAppSection extends Model
|
||||
{
|
||||
protected $table = 'mobile_app_sections';
|
||||
|
||||
public const TABLE_NAME = 'mobile_app_sections';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'heading',
|
||||
'description',
|
||||
'image',
|
||||
'feature_one',
|
||||
'feature_two',
|
||||
'feature_three',
|
||||
'play_store_link',
|
||||
'app_store_link',
|
||||
];
|
||||
}
|
||||
75
public/restaurant/Modules/Frontend/app/Models/Onboarding.php
Normal file
75
public/restaurant/Modules/Frontend/app/Models/Onboarding.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Authentication\Models\User;
|
||||
|
||||
class Onboarding extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id', // 🏢 Restaurant Information
|
||||
'restaurant_name',
|
||||
'restaurant_email',
|
||||
'restaurant_phone',
|
||||
'restaurant_domain',
|
||||
'restaurant_type',
|
||||
'restaurant_address',
|
||||
'restaurant_logo',
|
||||
|
||||
// 👤 Owner / User Information
|
||||
'name',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'avatar',
|
||||
|
||||
// 💰 Financial / Status
|
||||
'amount',
|
||||
'status',
|
||||
'approved_by',
|
||||
'approved_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*/
|
||||
protected $casts = [
|
||||
'approved_at' => 'datetime',
|
||||
'amount' => 'decimal:2',
|
||||
];
|
||||
|
||||
// ✅ The user who approved the onboarding
|
||||
public function approver(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_by');
|
||||
}
|
||||
|
||||
// Automatically hash password when setting it
|
||||
public function setPasswordAttribute($value): void
|
||||
{
|
||||
if (! empty($value)) {
|
||||
$this->attributes['password'] = bcrypt($value);
|
||||
}
|
||||
}
|
||||
|
||||
// Scope to get only approved onboardings
|
||||
public function scopeApproved($query): mixed
|
||||
{
|
||||
return $query->where('status', 'approved');
|
||||
}
|
||||
|
||||
// Scope to get pending onboardings
|
||||
public function scopePending($query): mixed
|
||||
{
|
||||
return $query->where('status', 'pending');
|
||||
}
|
||||
}
|
||||
23
public/restaurant/Modules/Frontend/app/Models/OurHistory.php
Normal file
23
public/restaurant/Modules/Frontend/app/Models/OurHistory.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class OurHistory extends Model
|
||||
{
|
||||
protected $table = 'our_histories';
|
||||
|
||||
public const TABLE_NAME = 'our_histories';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'year',
|
||||
'title',
|
||||
'descriptions',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
25
public/restaurant/Modules/Frontend/app/Models/Page.php
Normal file
25
public/restaurant/Modules/Frontend/app/Models/Page.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'slug',
|
||||
'type',
|
||||
'content',
|
||||
'meta_data',
|
||||
'seo_meta_keywords',
|
||||
'seo_meta_description',
|
||||
'page_status',
|
||||
'page_template',
|
||||
'author_id',
|
||||
];
|
||||
}
|
||||
22
public/restaurant/Modules/Frontend/app/Models/Policy.php
Normal file
22
public/restaurant/Modules/Frontend/app/Models/Policy.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Policy extends Model
|
||||
{
|
||||
protected $table = 'policies';
|
||||
|
||||
public const TABLE_NAME = 'policies';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'type',
|
||||
'description',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ReadyToJoinUs extends Model
|
||||
{
|
||||
protected $table = 'ready_to_join_us';
|
||||
|
||||
public const TABLE_NAME = 'ready_to_join_us';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'description',
|
||||
'icon',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Testimonial extends Model
|
||||
{
|
||||
protected $table = 'testimonials';
|
||||
|
||||
public const TABLE_NAME = 'testimonials';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'description',
|
||||
'thumbnail_image',
|
||||
'video_url',
|
||||
'note',
|
||||
'ratting',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
16
public/restaurant/Modules/Frontend/app/Models/Theme.php
Normal file
16
public/restaurant/Modules/Frontend/app/Models/Theme.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Theme extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'category',
|
||||
'name',
|
||||
'icon',
|
||||
'description',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Frontend\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WhyChooseUs extends Model
|
||||
{
|
||||
protected $table = 'why_choose_us';
|
||||
|
||||
public const TABLE_NAME = 'why_choose_us';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'description',
|
||||
'icon',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user