updates for admin area
This commit is contained in:
@@ -4,6 +4,8 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Booking extends Model
|
||||
{
|
||||
@@ -15,4 +17,24 @@ class Booking extends Model
|
||||
{
|
||||
return ['event_date' => 'date', 'total' => 'decimal:2', 'deposit' => 'decimal:2', 'paid_at' => 'datetime'];
|
||||
}
|
||||
|
||||
public function enquiry(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Enquiry::class);
|
||||
}
|
||||
|
||||
public function client(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'client_id');
|
||||
}
|
||||
|
||||
public function djProfile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DjProfile::class);
|
||||
}
|
||||
|
||||
public function review(): HasOne
|
||||
{
|
||||
return $this->hasOne(Review::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Enquiry extends Model
|
||||
{
|
||||
@@ -15,4 +17,19 @@ class Enquiry extends Model
|
||||
{
|
||||
return ['event_date' => 'date', 'budget' => 'decimal:2'];
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function djProfile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DjProfile::class);
|
||||
}
|
||||
|
||||
public function booking(): HasOne
|
||||
{
|
||||
return $this->hasOne(Booking::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,26 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class Review extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['booking_id', 'user_id', 'dj_profile_id', 'rating', 'title', 'body', 'status', 'dj_reply'];
|
||||
|
||||
public function booking(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Booking::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function djProfile(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(DjProfile::class);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-4
@@ -2,14 +2,19 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Cashier\Billable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens,HasRoles,Notifiable;
|
||||
use Billable, HasApiTokens, HasFactory, HasRoles, Notifiable;
|
||||
|
||||
protected $fillable = ['name', 'email', 'password', 'phone', 'avatar_path', 'marketing_opt_in'];
|
||||
|
||||
@@ -17,16 +22,31 @@ class User extends Authenticatable
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['email_verified_at' => 'datetime', 'password' => 'hashed', 'marketing_opt_in' => 'boolean'];
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
'password' => 'hashed',
|
||||
'marketing_opt_in' => 'boolean',
|
||||
'trial_ends_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
public function businesses()
|
||||
public function businesses(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Business::class)->withPivot(['role'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function djProfile()
|
||||
public function djProfile(): HasOne
|
||||
{
|
||||
return $this->hasOne(DjProfile::class);
|
||||
}
|
||||
|
||||
public function enquiries(): HasMany
|
||||
{
|
||||
return $this->hasMany(Enquiry::class);
|
||||
}
|
||||
|
||||
public function bookings(): HasMany
|
||||
{
|
||||
return $this->hasMany(Booking::class, 'client_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user