File "Review.php"
Full path: /home/orbitecv/orbite-school.orbit.et/app/Models/Review.php
File size: 736 B
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Edit Back
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class Review extends Model
{
protected $guarded = ['id'];
use HasFactory, SoftDeletes;
protected static function boot()
{
parent::boot();
static::addGlobalScope('created_at', function ($builder) {
$builder->orderBy('created_at');
});
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class)->withTrashed();
}
public function course(): BelongsTo
{
return $this->belongsTo(Course::class);
}
}