created admin panel with some of its content
This commit is contained in:
1 parent
2ee4b76599
commit
b16351c416
52 files changed
+5690
-203
No files matched your search
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class ClubReview extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'club_reviews';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'tenant_id',
|
||||
'user_id',
|
||||
'rating',
|
||||
'comment',
|
||||
'is_approved',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'rating' => 'integer',
|
||||
'is_approved' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the club that owns the review.
|
||||
*/
|
||||
public function tenant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tenant::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user who wrote the review.
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include approved reviews.
|
||||
*/
|
||||
public function scopeApproved($query)
|
||||
{
|
||||
return $query->where('is_approved', true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to only include pending reviews.
|
||||
*/
|
||||
public function scopePending($query)
|
||||
{
|
||||
return $query->where('is_approved', false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user