migrate to gtea from bistbucket

This commit is contained in:
2026-03-15 17:08:23 +07:00
commit 129ca2260c
3716 changed files with 566316 additions and 0 deletions

View 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');
}
}