2023-06-21 09:53:21 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
|
|
|
|
|
class User extends Authenticatable
|
|
|
|
{
|
|
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
|
|
|
|
protected $table = 'users';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
*
|
|
|
|
* @var array<int, string>
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
|
|
|
'name',
|
|
|
|
'email',
|
|
|
|
'password',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be hidden for serialization.
|
|
|
|
*
|
|
|
|
* @var array<int, string>
|
|
|
|
*/
|
|
|
|
protected $hidden = [
|
|
|
|
'password',
|
|
|
|
'remember_token',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be cast.
|
|
|
|
*
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'email_verified_at' => 'datetime',
|
2023-12-14 12:33:03 -05:00
|
|
|
'created_at' => 'datetime',
|
|
|
|
'updated_at' => 'datetime',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be appended.
|
|
|
|
*
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
protected $appends = [
|
|
|
|
|
2023-06-21 09:53:21 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
public function artists()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Artist::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function artworks()
|
|
|
|
{
|
|
|
|
return $this->hasManyThrough(Artwork::class, Artist::class);
|
|
|
|
}
|
|
|
|
|
2024-01-13 11:45:40 -05:00
|
|
|
public function selectedForEpisodes()
|
2023-06-21 09:53:21 -04:00
|
|
|
{
|
2024-01-13 11:45:40 -05:00
|
|
|
return $this->artists()->first()->episodes;
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function wallets()
|
|
|
|
{
|
|
|
|
return $this->hasManyThrough(Wallet::class, Artist::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|