cineflex/app/Models/Genre.php

26 lines
496 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Genre extends Model
{
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();
}
public function movies()
{
return $this->hasMany('App\Models\Movie', 'genre_id');
}
}