feat: initial laravel install, models, seeders
This commit is contained in:
44
site/app/Models/Artist.php
Normal file
44
site/app/Models/Artist.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?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'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongs_to(User::class);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
39
site/app/Models/Artwork.php
Normal file
39
site/app/Models/Artwork.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Artwork extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'artworks';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
public function podcast()
|
||||
{
|
||||
return $this->belongsTo(Podcast::class);
|
||||
}
|
||||
|
||||
public function artist()
|
||||
{
|
||||
return $this->belongsTo(Artist::class);
|
||||
}
|
||||
|
||||
public function episode()
|
||||
{
|
||||
return $this->belongsTo(Episode::class);
|
||||
}
|
||||
|
||||
public function overlay()
|
||||
{
|
||||
return $this->hasOne(Overlay::class);
|
||||
}
|
||||
|
||||
}
|
||||
32
site/app/Models/Episode.php
Normal file
32
site/app/Models/Episode.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Episode extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['episode_date', 'created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
public function podcast()
|
||||
{
|
||||
return $this->belongsTo(Podcast::class);
|
||||
}
|
||||
|
||||
public function artwork()
|
||||
{
|
||||
return $this->hasOne(Artwork::class);
|
||||
}
|
||||
|
||||
public function artist()
|
||||
{
|
||||
return $this->hasOneThrough(Artist::class, Artwork::class);
|
||||
}
|
||||
|
||||
}
|
||||
39
site/app/Models/Overlay.php
Normal file
39
site/app/Models/Overlay.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Overlay extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'overlays';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
|
||||
public function artist()
|
||||
{
|
||||
return $this->belongsTo(Artist::class);
|
||||
}
|
||||
|
||||
public function artworks()
|
||||
{
|
||||
return $this->belongsToMany(Artwork::class);
|
||||
}
|
||||
|
||||
public function postcast()
|
||||
{
|
||||
return $this->belongsTo(Podcast::class);
|
||||
}
|
||||
|
||||
public function episodes()
|
||||
{
|
||||
return $this->hasManyThrough(Episode::class, Artwork::class);
|
||||
}
|
||||
|
||||
}
|
||||
29
site/app/Models/Podcast.php
Normal file
29
site/app/Models/Podcast.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Podcast extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'podcasts';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'added_at'];
|
||||
|
||||
public function episodes()
|
||||
{
|
||||
return $this->hasMany(Episode::class);
|
||||
}
|
||||
|
||||
public function artists()
|
||||
{
|
||||
return $this->hasManyThrough(Artist::class, Episode::class);
|
||||
}
|
||||
|
||||
}
|
||||
69
site/app/Models/User.php
Normal file
69
site/app/Models/User.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* 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',
|
||||
];
|
||||
|
||||
public function artists()
|
||||
{
|
||||
return $this->hasMany(Artist::class);
|
||||
}
|
||||
|
||||
public function artworks()
|
||||
{
|
||||
return $this->hasManyThrough(Artwork::class, Artist::class);
|
||||
}
|
||||
|
||||
public function episodes()
|
||||
{
|
||||
return $this->hasManyThrough(Episode::class, Artwork::class);
|
||||
}
|
||||
|
||||
public function wallets()
|
||||
{
|
||||
return $this->hasManyThrough(Wallet::class, Artist::class);
|
||||
}
|
||||
|
||||
}
|
||||
31
site/app/Models/Wallet.php
Normal file
31
site/app/Models/Wallet.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Wallet extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'wallets';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
|
||||
public function walletType()
|
||||
{
|
||||
return $this->hasOne(WalletType::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOneThrough(User::class, Artist::class);
|
||||
}
|
||||
|
||||
public function artist()
|
||||
{
|
||||
return $this->belongsTo(Artist::class);
|
||||
}
|
||||
|
||||
}
|
||||
21
site/app/Models/WalletType.php
Normal file
21
site/app/Models/WalletType.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WalletType extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'wallet_types';
|
||||
|
||||
protected $dates = ['created_at', 'updated_at'];
|
||||
|
||||
public function wallets()
|
||||
{
|
||||
return $this->hasMany(Wallet::class);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user