39 lines
		
	
	
	
		
			680 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			680 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| class Rating extends Model
 | |
| {
 | |
| 
 | |
|     protected $table = 'ratings';
 | |
|     protected $primaryKey = 'rating_id';
 | |
|     public $timestamps = false;
 | |
|     protected $fillable = [
 | |
|         'movie_id',
 | |
|         'user_id',
 | |
|         'rating_value',
 | |
|     ];
 | |
| 
 | |
|     protected $hidden = [
 | |
|         'created_at',
 | |
|         'updated_at',
 | |
|     ];
 | |
| 
 | |
|     protected $casts = [
 | |
|         'rating_value' => 'decimal:1',
 | |
|     ];
 | |
| 
 | |
|     public function movie()
 | |
|     {
 | |
|         return $this->belongsTo(Movie::class, 'movie_id', 'movie_id');
 | |
|     }
 | |
| 
 | |
|     public function user()
 | |
|     {
 | |
|         return $this->belongsTo(User::class, 'user_id', 'user_id');
 | |
|     }
 | |
| 
 | |
| 
 | |
| }
 |