21 lines
405 B
PHP
21 lines
405 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Models\Game;
|
|
|
|
class Author extends Model
|
|
{
|
|
protected $table = 'authors';
|
|
public $timestamps = FALSE;
|
|
|
|
public function games() {
|
|
return $this->belongsToMany(Game::class, 'authors_games');
|
|
}
|
|
|
|
public static function findByName($name) {
|
|
return self::whereRaw('LOWER(name) = ?', mb_strtolower($name))->first();
|
|
}
|
|
}
|