Archived
1
0
Fork 0
This repository has been archived on 2021-07-30. You can view files and clone it, but cannot push or open issues or pull requests.
ifnews/app/Models/Author.php

21 lines
405 B
PHP
Raw Normal View History

2019-09-12 20:03:56 +03:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\Game;
class Author extends Model
{
2019-11-30 08:08:17 +02:00
protected $table = 'authors';
public $timestamps = FALSE;
2019-09-12 20:03:56 +03:00
public function games() {
return $this->belongsToMany(Game::class, 'authors_games');
2019-11-30 08:08:17 +02:00
}
public static function findByName($name) {
2020-10-21 09:45:37 +03:00
return self::whereRaw('LOWER(name) = ?', mb_strtolower($name))->first();
2019-11-30 08:08:17 +02:00
}
2019-09-12 20:03:56 +03:00
}