Remove unnecessary table name property

By convention, Laravel uses the "snake case", plural name of the class as the table name.
This commit is contained in:
Laravel Shift 2021-02-14 19:46:04 +00:00
parent 9374905d7b
commit 3b2d58b77f
17 changed files with 0 additions and 24 deletions

View file

@ -126,8 +126,6 @@ class Album extends Model implements Searchable, Commentable, Favouritable
return $query; return $query;
} }
protected $table = 'albums';
public function user() public function user()
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);

View file

@ -49,7 +49,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Announcement extends Model class Announcement extends Model
{ {
protected $table = 'announcements';
protected $casts = [ protected $casts = [
'links' => 'array', 'links' => 'array',

View file

@ -70,8 +70,6 @@ class Comment extends Model
{ {
use SoftDeletes; use SoftDeletes;
protected $table = 'comments';
public function user() public function user()
{ {
return $this->belongsTo(User::class); return $this->belongsTo(User::class);

View file

@ -47,7 +47,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Favourite extends Model class Favourite extends Model
{ {
protected $table = 'favourites';
public $timestamps = false; public $timestamps = false;
/* /*

View file

@ -42,7 +42,6 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*/ */
class Follower extends Model class Follower extends Model
{ {
protected $table = 'followers';
public $timestamps = false; public $timestamps = false;

View file

@ -60,8 +60,6 @@ class Genre extends Model
{ {
use HasFactory; use HasFactory;
protected $table = 'genres';
protected $fillable = ['name', 'slug']; protected $fillable = ['name', 'slug'];
protected $appends = ['track_count', 'url']; protected $appends = ['track_count', 'url'];
protected $hidden = ['trackCountRelation']; protected $hidden = ['trackCountRelation'];

View file

@ -165,8 +165,6 @@ class Image extends Model
chmod($path, 0644); chmod($path, 0644);
} }
protected $table = 'images';
public function getUrl($type = self::NORMAL) public function getUrl($type = self::NORMAL)
{ {
$type = self::$ImageTypes[$type]; $type = self::$ImageTypes[$type];

View file

@ -41,5 +41,4 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class License extends Model class License extends Model
{ {
protected $table = 'licenses';
} }

View file

@ -41,7 +41,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class PinnedPlaylist extends Model class PinnedPlaylist extends Model
{ {
protected $table = 'pinned_playlists';
public function user() public function user()
{ {

View file

@ -94,8 +94,6 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
protected $elasticsearchType = 'playlist'; protected $elasticsearchType = 'playlist';
protected $table = 'playlists';
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'user_id' => 'integer', 'user_id' => 'integer',

View file

@ -51,7 +51,6 @@ use Illuminate\Support\Facades\Request;
*/ */
class ResourceLogItem extends Model class ResourceLogItem extends Model
{ {
protected $table = 'resource_log_items';
public $timestamps = false; public $timestamps = false;
protected $dates = ['created_at']; protected $dates = ['created_at'];

View file

@ -53,7 +53,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class ResourceUser extends Model class ResourceUser extends Model
{ {
protected $table = 'resource_users';
public $timestamps = false; public $timestamps = false;
public static function get($userId, $resourceType, $resourceId) public static function get($userId, $resourceType, $resourceId)

View file

@ -34,7 +34,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class Role extends Model class Role extends Model
{ {
protected $table = 'roles';
public $timestamps = false; public $timestamps = false;
public function users() public function users()

View file

@ -46,7 +46,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class ShowSong extends Model class ShowSong extends Model
{ {
protected $table = 'show_songs';
protected $fillable = ['title', 'slug', 'lyrics']; protected $fillable = ['title', 'slug', 'lyrics'];
public function trackCountRelation() public function trackCountRelation()

View file

@ -692,8 +692,6 @@ class Track extends Model implements Searchable, Commentable, Favouritable
]; ];
} }
protected $table = 'tracks';
public function genre() public function genre()
{ {
return $this->belongsTo(Genre::class); return $this->belongsTo(Genre::class);

View file

@ -35,7 +35,6 @@ use Illuminate\Database\Eloquent\Model;
*/ */
class TrackType extends Model class TrackType extends Model
{ {
protected $table = 'track_types';
const ORIGINAL_TRACK = 1; const ORIGINAL_TRACK = 1;
const OFFICIAL_TRACK_REMIX = 2; const OFFICIAL_TRACK_REMIX = 2;

View file

@ -109,8 +109,6 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
use Authenticatable, CanResetPassword, Authorizable, RevisionableTrait, IndexedInElasticsearchTrait; use Authenticatable, CanResetPassword, Authorizable, RevisionableTrait, IndexedInElasticsearchTrait;
protected $elasticsearchType = 'user'; protected $elasticsearchType = 'user';
protected $table = 'users';
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'sync_names' => 'boolean', 'sync_names' => 'boolean',