mega-commit: migrations, controllers, models, etc.
This commit is contained in:
parent
9732135e90
commit
2c6745e812
70 changed files with 2124 additions and 400 deletions
26
app/Models/Genre.php
Normal file
26
app/Models/Genre.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?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');
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue