mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
chore: better firstOrCreate usage
This commit is contained in:
parent
3e245ee13e
commit
ef140d8819
5 changed files with 4 additions and 5 deletions
|
@ -20,7 +20,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
|||
* @property Collection $songs
|
||||
* @property bool $is_unknown
|
||||
*
|
||||
* @method static self firstOrCreate(array $where, array $params)
|
||||
* @method static self firstOrCreate(array $where, array $params = [])
|
||||
*/
|
||||
class Album extends Model
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
|||
* @property bool $has_image
|
||||
*
|
||||
* @method static self find(int $id)
|
||||
* @method static self firstOrCreate(array $where, array $params)
|
||||
* @method static self firstOrCreate(array $where, array $params = [])
|
||||
*/
|
||||
class Artist extends Model
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ class Artist extends Model
|
|||
|
||||
$name = trim($name) ?: self::UNKNOWN_NAME;
|
||||
|
||||
return static::firstOrCreate(compact('name'), compact('name'));
|
||||
return static::firstOrCreate(compact('name'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|||
* @property Song $song
|
||||
* @property User $user
|
||||
* @property int $id
|
||||
* @method self firstOrCreate(array $where, array $params = [])
|
||||
*/
|
||||
class Interaction extends Model
|
||||
{
|
||||
|
|
|
@ -11,7 +11,6 @@ class AlbumTableSeeder extends Seeder
|
|||
Album::firstOrCreate([
|
||||
'id' => Album::UNKNOWN_ID,
|
||||
], [
|
||||
'id' => Album::UNKNOWN_ID,
|
||||
'artist_id' => Artist::UNKNOWN_ID,
|
||||
'name' => Album::UNKNOWN_NAME,
|
||||
'cover' => Album::UNKNOWN_COVER,
|
||||
|
|
|
@ -10,7 +10,6 @@ class ArtistTableSeeder extends Seeder
|
|||
Artist::firstOrCreate([
|
||||
'id' => Artist::UNKNOWN_ID,
|
||||
], [
|
||||
'id' => Artist::UNKNOWN_ID,
|
||||
'name' => Artist::UNKNOWN_NAME,
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue