2023-06-21 09:53:21 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
|
|
class Artist extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
use SoftDeletes;
|
|
|
|
|
|
|
|
protected $table = 'artists';
|
|
|
|
|
|
|
|
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
|
|
|
|
2023-12-14 12:33:03 -05:00
|
|
|
protected $casts = [
|
|
|
|
'created_at' => 'datetime',
|
|
|
|
'updated_at' => 'datetime',
|
|
|
|
'deleted_at' => 'datetime',
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
'user_id',
|
|
|
|
'name',
|
|
|
|
'slug',
|
|
|
|
'avatar',
|
|
|
|
'header',
|
|
|
|
'location',
|
2023-12-21 11:20:49 -05:00
|
|
|
'alby',
|
|
|
|
'naasocial',
|
2023-12-14 12:33:03 -05:00
|
|
|
'website',
|
|
|
|
'bio',
|
|
|
|
'created_at',
|
|
|
|
'updated_at',
|
|
|
|
'deleted_at',
|
|
|
|
];
|
|
|
|
|
2023-06-21 09:53:21 -04:00
|
|
|
public function user()
|
|
|
|
{
|
2023-12-14 12:33:03 -05:00
|
|
|
return $this->belongsTo(User::class);
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public function artworks()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Artwork::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function overlays()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Overlay::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function episodes()
|
|
|
|
{
|
|
|
|
return $this->hasManyThrough(Episode::class, Artwork::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function wallets()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Wallet::class);
|
|
|
|
}
|
|
|
|
|
2023-12-17 13:32:35 -05:00
|
|
|
public function avatar()
|
|
|
|
{
|
|
|
|
if (!$this->avatar) {
|
2023-12-20 14:45:19 -05:00
|
|
|
return config('app.static_asset_url') . '/avatars/default_avatar_male.svg';
|
2023-12-17 13:32:35 -05:00
|
|
|
}
|
|
|
|
return config('app.static_asset_url') . '/' . $this->avatar;
|
|
|
|
}
|
|
|
|
|
2023-12-20 14:45:19 -05:00
|
|
|
public function header()
|
|
|
|
{
|
|
|
|
if (!$this->header) {
|
|
|
|
return config('app.static_asset_url') . '/artist_headers/default_artist_banner.png';
|
|
|
|
}
|
|
|
|
return config('app.static_asset_url') . '/' . $this->header;
|
|
|
|
}
|
|
|
|
|
2023-06-21 09:53:21 -04:00
|
|
|
}
|