*/ protected $fillable = [ 'tenant_id', 'user_id', 'rating', 'comment', 'is_approved', ]; /** * The attributes that should be cast. * * @var array */ 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); } }