refactor: use plural table names

Leave out history and tv for now as their plural isn't obvious.
This commit is contained in:
Roardom
2023-12-23 02:03:55 +00:00
parent ed5749fc62
commit 33a1da18c7
16 changed files with 19 additions and 47 deletions

View File

@@ -39,7 +39,7 @@ class StoreTransactionRequest extends FormRequest
return [
'exchange' => [
'required',
'exists:bon_exchange,id',
'exists:bon_exchanges,id',
],
];
}

View File

@@ -20,13 +20,6 @@ class BonExchange extends Model
{
use HasFactory;
/**
* The Database Table Used By The Model.
*
* @var string
*/
protected $table = 'bon_exchange';
/**
* Indicates If The Model Should Be Timestamped.
*

View File

@@ -24,8 +24,6 @@ class Collection extends Model
public $timestamps = false;
protected $table = 'collection';
/**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany<Comment>
*/

View File

@@ -24,8 +24,6 @@ class Company extends Model
public $timestamps = false;
public $table = 'companies';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Movie>
*/

View File

@@ -26,8 +26,6 @@ class Episode extends Model
protected string $orderDirection = 'ASC';
public $table = 'episodes';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<Season, self>
*/

View File

@@ -24,8 +24,6 @@ class Genre extends Model
public $timestamps = false;
public $table = 'genres';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Movie>
*/

View File

@@ -24,7 +24,7 @@ class GuestStar extends Model
public $timestamps = false;
public $table = 'person';
public $table = 'people';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Episode>

View File

@@ -23,8 +23,6 @@ class Movie extends Model
protected $guarded = [];
public $table = 'movie';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Genre>
*/

View File

@@ -24,8 +24,6 @@ class Network extends Model
public $timestamps = false;
public $table = 'networks';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Tv>
*/

View File

@@ -25,8 +25,6 @@ class Person extends Model
public $timestamps = false;
public $table = 'person';
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<Tv>
*/

View File

@@ -22,13 +22,6 @@ class PersonalFreeleech extends Model
use Auditable;
use HasFactory;
/**
* The Database Table Used By The Model.
*
* @var string
*/
protected $table = 'personal_freeleech';
/**
* The attributes that aren't mass assignable.
*

View File

@@ -24,8 +24,6 @@ class Season extends Model
public $timestamps = false;
public $table = 'seasons';
/**
* Has Many Torrents.
*

View File

@@ -24,13 +24,6 @@ class Seedbox extends Model
use Encryptable;
use HasFactory;
/**
* The Database Table Used By The Model.
*
* @var string
*/
protected $table = 'clients';
/**
* The Attributes That Are Encrypted.
*

View File

@@ -27,13 +27,6 @@ class UserEcho extends Model
*/
public $timestamps = true;
/**
* The Database Table Used By The Model.
*
* @var string
*/
protected $table = 'user_echoes';
/**
* Belongs To A User.
*

View File

@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class () extends Migration {
public function up(): void
{
Schema::rename('bon_exchange', 'bon_exchanges');
Schema::rename('collection', 'collections');
Schema::rename('movie', 'movies');
Schema::rename('person', 'people');
Schema::rename('personal_freeleech', 'personal_freeleeches');
Schema::rename('clients', 'seedboxes');
}
};

View File

@@ -32,7 +32,7 @@ test('rules', function (): void {
'exchange' => [
'bail',
'required',
'exists:bon_exchange,id',
'exists:bon_exchanges,id',
],
], $actual);
});