Initial Commit
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Booking extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['enquiry_id', 'client_id', 'dj_profile_id', 'event_date', 'total', 'deposit', 'status', 'paid_at'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['event_date' => 'date', 'total' => 'decimal:2', 'deposit' => 'decimal:2', 'paid_at' => 'datetime'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Business extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['name', 'slug', 'description', 'email', 'phone', 'website', 'status', 'verified_at'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['verified_at' => 'datetime'];
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany(User::class)->withPivot(['role'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function profiles()
|
||||
{
|
||||
return $this->hasMany(DjProfile::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DjProfile extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['user_id', 'business_id', 'stage_name', 'slug', 'headline', 'bio', 'city', 'service_radius_miles', 'price_from', 'profile_photo', 'cover_photo', 'verified_at', 'is_featured', 'is_published', 'average_rating', 'review_count'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['verified_at' => 'datetime', 'is_featured' => 'boolean', 'is_published' => 'boolean', 'price_from' => 'decimal:2', 'average_rating' => 'decimal:2'];
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function business()
|
||||
{
|
||||
return $this->belongsTo(Business::class);
|
||||
}
|
||||
|
||||
public function genres()
|
||||
{
|
||||
return $this->belongsToMany(Genre::class);
|
||||
}
|
||||
|
||||
public function reviews()
|
||||
{
|
||||
return $this->hasMany(Review::class);
|
||||
}
|
||||
|
||||
public function enquiries()
|
||||
{
|
||||
return $this->hasMany(Enquiry::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Enquiry extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['user_id', 'dj_profile_id', 'event_type', 'event_date', 'start_time', 'end_time', 'venue', 'postcode', 'guest_count', 'budget', 'message', 'status'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['event_date' => 'date', 'budget' => 'decimal:2'];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Genre extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'slug'];
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Review extends Model
|
||||
{
|
||||
use HasUlids;
|
||||
|
||||
protected $fillable = ['booking_id', 'user_id', 'dj_profile_id', 'rating', 'title', 'body', 'status', 'dj_reply'];
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable
|
||||
{
|
||||
use HasApiTokens,HasRoles,Notifiable;
|
||||
|
||||
protected $fillable = ['name', 'email', 'password', 'phone', 'avatar_path', 'marketing_opt_in'];
|
||||
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return ['email_verified_at' => 'datetime', 'password' => 'hashed', 'marketing_opt_in' => 'boolean'];
|
||||
}
|
||||
|
||||
public function businesses()
|
||||
{
|
||||
return $this->belongsToMany(Business::class)->withPivot(['role'])->withTimestamps();
|
||||
}
|
||||
|
||||
public function djProfile()
|
||||
{
|
||||
return $this->hasOne(DjProfile::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user