migrate to gtea from bistbucket
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Feedback extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'feedback';
|
||||
|
||||
public const TABLE_NAME = 'feedback';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'description',
|
||||
'status',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id')->select('id', 'first_name', 'phone', 'email', 'avatar');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Gallery extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'title',
|
||||
'image',
|
||||
'type',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'languages';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'name',
|
||||
'code',
|
||||
'file_path',
|
||||
'flag',
|
||||
'is_default',
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'is_default' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Accessor for full flag URL
|
||||
*/
|
||||
public function getFlagUrlAttribute()
|
||||
{
|
||||
return $this->flag ? asset("storage/{$this->flag}") : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor for full JSON file URL
|
||||
*/
|
||||
public function getFileUrlAttribute()
|
||||
{
|
||||
return $this->file_path ? asset("storage/{$this->file_path}") : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Modules\Restaurant\Models\DeliveryCharge;
|
||||
use Modules\Restaurant\Models\Order;
|
||||
use Modules\Restaurant\Models\RestaurantSchedule;
|
||||
use Modules\Restaurant\Models\Zone;
|
||||
|
||||
class Restaurant extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
public const TABLE_NAME = 'restaurants';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'owner_id',
|
||||
'assigned_to',
|
||||
'name',
|
||||
'email',
|
||||
'address',
|
||||
'restaurant_type',
|
||||
'phone',
|
||||
'domain',
|
||||
'platform',
|
||||
'last_active_time',
|
||||
'logo',
|
||||
'status',
|
||||
'theme_id',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* Attribute Casting
|
||||
*/
|
||||
protected $casts = [
|
||||
'owner_id' => 'integer',
|
||||
'assigned_to' => 'integer',
|
||||
'last_active_time' => 'datetime',
|
||||
'status' => 'boolean',
|
||||
'created_at' => 'datetime',
|
||||
'updated_at' => 'datetime',
|
||||
'deleted_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the owner of the restaurant.
|
||||
*/
|
||||
public function owner(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'owner_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user assigned to this restaurant.
|
||||
*/
|
||||
public function assignedUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'assigned_to');
|
||||
}
|
||||
|
||||
public function subscription(): HasOne
|
||||
{
|
||||
return $this->hasOne(Subscription::class, 'restaurant_id', 'id')->with('package');
|
||||
}
|
||||
|
||||
public function zone(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Zone::class);
|
||||
}
|
||||
|
||||
public function schedules(): HasMany
|
||||
{
|
||||
return $this->hasMany(RestaurantSchedule::class);
|
||||
}
|
||||
|
||||
public function deliveryCharges(): HasMany
|
||||
{
|
||||
return $this->hasMany(DeliveryCharge::class);
|
||||
}
|
||||
|
||||
public function orders(): HasMany
|
||||
{
|
||||
return $this->hasMany(Order::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RestaurantImageSAASSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'header_logo_light_theme',
|
||||
'header_logo_dark_theme',
|
||||
'footer_logo_light_theme',
|
||||
'footer_logo_dark_theme',
|
||||
'banner_image',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'restaurant_image_s_a_a_s_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class RestaurantImageSetting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'header_logo_light_theme',
|
||||
'header_logo_dark_theme',
|
||||
'footer_logo_light_theme',
|
||||
'footer_logo_dark_theme',
|
||||
'banner_image',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public const TABLE_NAME = 'restaurant_image_settings';
|
||||
|
||||
protected $table = self::TABLE_NAME;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SAASFaq extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 's_a_a_s_faqs';
|
||||
|
||||
public const TABLE_NAME = 's_a_a_s_faqs';
|
||||
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'question',
|
||||
'answer',
|
||||
'status',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class SAASSetting extends Model
|
||||
{
|
||||
protected $table = 's_a_a_s_settings';
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
// cast value will be json decode
|
||||
protected $casts = [
|
||||
'payment_info' => 'array',
|
||||
'sms_info' => 'array',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SAASSubscription extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 's_a_a_s_subscriptions';
|
||||
|
||||
public const TABLE_NAME = 's_a_a_s_subscriptions';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'email',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Setting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'setting_type',
|
||||
'option_key',
|
||||
'option_value',
|
||||
'deleted_at',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Subscription extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $hidden = [
|
||||
'updated_at',
|
||||
'is_active',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function package(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Package::class);
|
||||
}
|
||||
|
||||
public function subscriptionItems(): HasMany
|
||||
{
|
||||
return $this->hasMany(SubscriptionItem::class);
|
||||
}
|
||||
|
||||
public function restaurant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Restaurant::class, 'restaurant_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SubscriptionItem extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $hidden = [
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'amount' => 'float',
|
||||
];
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function package(): HasOne
|
||||
{
|
||||
return $this->hasOne(Package::class, 'id', 'package_id');
|
||||
}
|
||||
|
||||
public function restaurant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Restaurant::class, 'restaurant_id', 'id');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SubscriptionUpgradeRequest extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'package_id',
|
||||
'extra_days',
|
||||
'amount_paid',
|
||||
'payment_method',
|
||||
'notes',
|
||||
'status',
|
||||
'approved_by',
|
||||
'approved_at',
|
||||
];
|
||||
|
||||
public function restaurant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Restaurant::class)->select('id', 'name');
|
||||
}
|
||||
|
||||
public function package(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Package::class)->select('id', 'name', 'price', 'duration');
|
||||
}
|
||||
|
||||
public function approver(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_by');
|
||||
}
|
||||
}
|
||||
125
public/restaurant/Modules/Authentication/app/Models/User.php
Normal file
125
public/restaurant/Modules/Authentication/app/Models/User.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
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 Modules\Authentication\Database\Factories\UserFactory;
|
||||
use Modules\RestaurantDelivery\Models\Rider;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens, HasFactory, HasRoles, Notifiable, SoftDeletes;
|
||||
|
||||
public const TABLE_NAME = 'users';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'username',
|
||||
'email',
|
||||
'phone',
|
||||
'password',
|
||||
'otp_code',
|
||||
'isVerified',
|
||||
'email_verified_at',
|
||||
'address',
|
||||
'avatar',
|
||||
'role_id',
|
||||
'user_type',
|
||||
'facebook',
|
||||
'twitter',
|
||||
'linkedin',
|
||||
'google_plus',
|
||||
'nid',
|
||||
'platform',
|
||||
'device_info',
|
||||
'last_active_time',
|
||||
'status',
|
||||
'bio',
|
||||
'fcm_token',
|
||||
'qr_code',
|
||||
'department_id',
|
||||
'designation_id',
|
||||
'salary_type_id',
|
||||
'address',
|
||||
'gender',
|
||||
'date_of_birth',
|
||||
'joining_date',
|
||||
'basic_salary',
|
||||
'created_by',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* 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',
|
||||
];
|
||||
}
|
||||
|
||||
public function role(): HasOne
|
||||
{
|
||||
return $this->hasOne(Role::class, 'id', 'role_id');
|
||||
}
|
||||
|
||||
public function restaurant(): HasOne
|
||||
{
|
||||
return $this->hasOne(Restaurant::class, 'id', 'restaurant_id')->select('id', 'name', 'address', 'domain');
|
||||
}
|
||||
|
||||
public function rider(): HasOne
|
||||
{
|
||||
return $this->hasOne(Rider::class, 'user_id', 'id');
|
||||
}
|
||||
|
||||
public function customer(): HasOne
|
||||
{
|
||||
return $this->hasOne(User::class);
|
||||
}
|
||||
|
||||
protected static function newFactory(): UserFactory
|
||||
{
|
||||
return UserFactory::new();
|
||||
}
|
||||
|
||||
// Example: single FCM token
|
||||
public function routeNotificationForFcm(): mixed
|
||||
{
|
||||
return $this->fcm_token;
|
||||
}
|
||||
|
||||
// Or for multiple devices
|
||||
public function getDeviceTokens(): mixed
|
||||
{
|
||||
return $this->deviceTokens()->pluck('token')->toArray();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use App\Enum\ActionStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class UserLog extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'user_id',
|
||||
'ip_address',
|
||||
'action',
|
||||
'detail',
|
||||
'previous_detail',
|
||||
'model',
|
||||
'model_id',
|
||||
'url',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'action' => ActionStatus::class,
|
||||
];
|
||||
|
||||
public function user(): HasOne
|
||||
{
|
||||
return $this->hasOne(User::class, 'id', 'user_id')->select('id', 'name');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Authentication\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ZoomMeeting extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'restaurant_id',
|
||||
'meeting_id',
|
||||
'topic',
|
||||
'agenda',
|
||||
'start_time',
|
||||
'duration',
|
||||
'password',
|
||||
'join_url',
|
||||
'start_url',
|
||||
'created_by',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user