feat: initial laravel install, models, seeders

This commit is contained in:
2023-06-21 08:53:21 -05:00
parent 86d989b51c
commit 1c81ca91d1
178 changed files with 20002 additions and 1 deletions

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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);
}
}

View 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
View 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);
}
}

View 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);
}
}

View 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);
}
}