cineflex/app/Models/Genre.php

27 lines
496 B
PHP
Raw Normal View History

2022-11-23 09:32:34 +01:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
2022-11-23 09:32:34 +01:00
{
protected $table = 'genres';
protected $primaryKey = 'genre_id';
public $timestamps = false;
protected $fillable = [
'genre_name',
];
public function findGenreByName($genre_name)
{
return Genre::where('genre_name', $genre_name)->first();
}
2022-11-23 09:32:34 +01:00
public function movies()
{
return $this->hasMany('App\Models\Movie', 'genre_id');
2022-11-23 09:32:34 +01:00
}
}