Update models

This commit is contained in:
DariusIII
2017-11-01 23:16:22 +01:00
parent bbcad8ae0e
commit 091cae1e52
26 changed files with 54 additions and 145 deletions
+1
View File
@@ -1,4 +1,5 @@
2017-11-01 DariusIII
* Chg: Update models
* Chg: Send 503 Service Unavailable header in showApiError function
* Chg: Further change some queries to ease unnecessary loading of releases table columns that are not used later
* Chg: Load only required columns from releases table for api searches
+2 -2
View File
@@ -33,11 +33,11 @@ class AnidbEpisode extends Model
public function title()
{
return $this->belongsTo('App\Models\AnidbTitle', 'anidbid');
return $this->belongsTo(AnidbTitle::class, 'anidbid');
}
public function info()
{
return $this->hasMany('App\Modles\AnidbInfo', 'anidbid');
return $this->hasMany(AnidbInfo::class, 'anidbid');
}
}
+2 -2
View File
@@ -33,11 +33,11 @@ class AnidbInfo extends Model
public function title()
{
return $this->belongsTo('App\Models\AnidbTitle', 'anidbid');
return $this->belongsTo(AnidbTitle::class, 'anidbid');
}
public function episode()
{
return $this->belongsTo('App\Models\AnidbEpisode', 'anidbid');
return $this->belongsTo(AnidbEpisode::class, 'anidbid');
}
}
+2 -2
View File
@@ -33,11 +33,11 @@ class AnidbTitle extends Model
public function episode()
{
return $this->hasMany('App\Models\AnidbEpisode', 'anidbid');
return $this->hasMany(AnidbEpisode::class, 'anidbid');
}
public function info()
{
return $this->hasMany('App\Models\AnidbInfo', 'anidbid');
return $this->hasMany(AnidbInfo::class, 'anidbid');
}
}
+3 -3
View File
@@ -23,7 +23,7 @@ class Category extends Model
public function releases()
{
return $this->hasMany('App\Models\Release', 'categories_id');
return $this->hasMany(Release::class, 'categories_id');
}
public function parent()
@@ -38,11 +38,11 @@ class Category extends Model
public function userExcludedCategory()
{
return $this->hasMany('App\Models\UserExcludedCategory', 'categories_id');
return $this->hasMany(UserExcludedCategory::class, 'categories_id');
}
public function roleExcludedCategory()
{
return $this->belongsTo('App\Models\RoleExcludedCategory', 'categories_id');
return $this->belongsTo(RoleExcludedCategory::class, 'categories_id');
}
}
+2 -2
View File
@@ -35,11 +35,11 @@ class DnzbFailure extends Model
public function release()
{
return $this->belongsTo('App\Models\Release', 'release_id');
return $this->belongsTo(Release::class, 'release_id');
}
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
}
+1 -1
View File
@@ -22,6 +22,6 @@ class Genre extends Model
public function music()
{
return $this->hasMany('App\Models\MusicInfo', 'genres_id');
return $this->hasMany(MusicInfo::class, 'genres_id');
}
}
+1 -1
View File
@@ -23,6 +23,6 @@ class Group extends Model
public function release()
{
return $this->hasMany('App\Models\Release', 'groups_id');
return $this->hasMany(Release::class, 'groups_id');
}
}
+1 -1
View File
@@ -23,6 +23,6 @@ class Invitation extends Model
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
}
+1 -1
View File
@@ -27,6 +27,6 @@ class MusicInfo extends Model
public function genre()
{
return $this->belongsTo('App\Models\Genre', 'genres_id');
return $this->belongsTo(Genre::class, 'genres_id');
}
}
+2 -2
View File
@@ -32,11 +32,11 @@ class Predb extends Model
public function hash()
{
return $this->hasMany('App\Models\PredbHash', 'predb_id');
return $this->hasMany(PredbHash::class, 'predb_id');
}
public function release()
{
return $this->hasOne('App\Models\Release', 'predb_id');
return $this->hasMany(Release::class, 'predb_id');
}
}
+1 -1
View File
@@ -36,6 +36,6 @@ class PredbHash extends Model
*/
public function predb()
{
return $this->belongsTo('App\Models\Predb', 'predb_id');
return $this->belongsTo(Predb::class, 'predb_id');
}
}
+11 -11
View File
@@ -26,7 +26,7 @@ class Release extends Model
*/
public function group()
{
return $this->belongsTo('App\Models\Group', 'groups_id');
return $this->belongsTo(Group::class, 'groups_id');
}
/**
@@ -34,7 +34,7 @@ class Release extends Model
*/
public function download()
{
return $this->hasMany('App\Models\UserDownload', 'releases_id');
return $this->hasMany(UserDownload::class, 'releases_id');
}
/**
@@ -42,12 +42,12 @@ class Release extends Model
*/
public function userRelease()
{
return $this->hasMany('App\Models\UsersRelease', 'releases_id');
return $this->hasMany(UsersRelease::class, 'releases_id');
}
public function file()
{
return $this->hasMany('App\Models\ReleaseFile', 'releases_id');
return $this->hasMany(ReleaseFile::class, 'releases_id');
}
/**
@@ -55,7 +55,7 @@ class Release extends Model
*/
public function category()
{
return $this->belongsTo('App\Models\Category', 'categories_id');
return $this->belongsTo(Category::class, 'categories_id');
}
/**
@@ -63,7 +63,7 @@ class Release extends Model
*/
public function predb()
{
return $this->belongsTo('App\Models\Predb', 'predb_id');
return $this->belongsTo(Predb::class, 'predb_id');
}
/**
@@ -71,15 +71,15 @@ class Release extends Model
*/
public function failed()
{
return $this->hasMany('App\Models\DnzbFailure', 'release_id');
return $this->hasMany(DnzbFailure::class, 'release_id');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasOne
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function releaseExtra()
{
return $this->hasOne('App\Models\Release', 'releases_id');
return $this->hasMany(ReleaseExtraFull::class, 'releases_id');
}
/**
@@ -87,7 +87,7 @@ class Release extends Model
*/
public function nfo()
{
return $this->hasOne('App\Models\ReleaseNfo', 'releases_id');
return $this->hasOne(ReleaseNfo::class, 'releases_id');
}
/**
@@ -95,6 +95,6 @@ class Release extends Model
*/
public function comment()
{
return $this->hasMany('App\Models\ReleaseComment', 'releases_id');
return $this->hasMany(ReleaseComment::class, 'releases_id');
}
}
+2 -2
View File
@@ -21,7 +21,7 @@ class ReleaseComment extends Model
*/
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
/**
@@ -29,6 +29,6 @@ class ReleaseComment extends Model
*/
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
}
+1 -1
View File
@@ -38,6 +38,6 @@ class ReleaseExtraFull extends Model
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
}
+1 -1
View File
@@ -23,6 +23,6 @@ class ReleaseFile extends Model
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
}
+1 -1
View File
@@ -25,6 +25,6 @@ class ReleaseNfo extends Model
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
}
-35
View File
@@ -1,35 +0,0 @@
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program (see LICENSE.txt in the base directory. If
* not, see:.
*
* @link <http://www.gnu.org/licenses/>.
* @author niel
* @copyright 2016 nZEDb
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class ReleasesGroups extends Model
{
protected $table = 'releases_groups';
public $incrementing = false;
public $timestamps = false;
public $dateFormat = false;
protected $primaryKey = ['releases_id', 'groups_id'];
}
+2 -2
View File
@@ -12,11 +12,11 @@ class RoleExcludedCategory extends Model
public function role()
{
return $this->belongsTo('App\Models\UserRole', 'user_roles_id');
return $this->belongsTo(UserRole::class, 'user_roles_id');
}
public function category()
{
return $this->hasMany('App\Models\Category', 'categories_id');
return $this->hasMany(Category::class, 'categories_id');
}
}
-57
View File
@@ -1,57 +0,0 @@
<?php
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program (see LICENSE.txt in the base directory. If
* not, see:.
*
* @link <http://www.gnu.org/licenses/>.
* @author DariusIII
* @copyright 2016 NNTmux/nZEDb
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class SteamApps extends Model
{
/**
* @var string
*/
protected $table = 'steam_apps';
/**
* @var bool
*/
public $timestamps = false;
/**
* @var bool
*/
public $dateFormat = false;
/**
* @var array
*/
protected $fillable = ['name', 'appid'];
/**
* @var array
*/
protected $primaryKey = 'name';
protected $keyType = 'string';
/**
* @var bool
*/
public $incrementing = false;
}
+8 -8
View File
@@ -34,7 +34,7 @@ class User extends Authenticatable
*/
public function role()
{
return $this->belongsTo('App\Models\UserRole', 'user_roles_id');
return $this->belongsTo(UserRole::class, 'user_roles_id');
}
/**
@@ -42,7 +42,7 @@ class User extends Authenticatable
*/
public function request()
{
return $this->hasMany('App\Models\UserRequest', 'users_id');
return $this->hasMany(UserRequest::class, 'users_id');
}
/**
@@ -50,7 +50,7 @@ class User extends Authenticatable
*/
public function download()
{
return $this->hasMany('App\Models\UserDownload', 'users_id');
return $this->hasMany(UserDownload::class, 'users_id');
}
/**
@@ -58,7 +58,7 @@ class User extends Authenticatable
*/
public function release()
{
return $this->hasMany('\App\Models\UsersRelease', 'users_id');
return $this->hasMany(UsersRelease::class, 'users_id');
}
/**
@@ -66,7 +66,7 @@ class User extends Authenticatable
*/
public function invitation()
{
return $this->hasMany('App\Models\Invitation', 'users_id');
return $this->hasMany(Invitation::class, 'users_id');
}
/**
@@ -74,7 +74,7 @@ class User extends Authenticatable
*/
public function failedRelease()
{
return $this->hasMany('App\Models\DnzbFailure', 'users_id');
return $this->hasMany(DnzbFailure::class, 'users_id');
}
/**
@@ -82,7 +82,7 @@ class User extends Authenticatable
*/
public function excludedCategory()
{
return $this->hasMany('App\Models\UserExcludedCategory', 'users_id');
return $this->hasMany(UserExcludedCategory::class, 'users_id');
}
/**
@@ -90,7 +90,7 @@ class User extends Authenticatable
*/
public function comment()
{
return $this->hasMany('App\Models\ReleaseComment', 'users_id');
return $this->hasMany(ReleaseComment::class, 'users_id');
}
protected static function boot(): void
+2 -2
View File
@@ -23,11 +23,11 @@ class UserDownload extends Model
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
}
+2 -2
View File
@@ -12,11 +12,11 @@ class UserExcludedCategory extends Model
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
public function category()
{
return $this->belongsTo('App\Models\Category', 'categories_id');
return $this->belongsTo(Category::class, 'categories_id');
}
}
+1 -1
View File
@@ -28,6 +28,6 @@ class UserRequest extends Model
public function user()
{
return $this->belongsTo('App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
}
+2 -2
View File
@@ -26,11 +26,11 @@ class UserRole extends Model
*/
public function users()
{
return $this->hasMany('App\Models\User', 'user_roles_id');
return $this->hasMany(User::class, 'user_roles_id');
}
public function roleExcludedCategory()
{
return $this->hasMany('App\Models\RoleExcludedCategory', 'user_roles_id');
return $this->hasMany(RoleExcludedCategory::class, 'user_roles_id');
}
}
+2 -2
View File
@@ -18,11 +18,11 @@ class UsersRelease extends Model
public function user()
{
return $this->belongsTo('\App\Models\User', 'users_id');
return $this->belongsTo(User::class, 'users_id');
}
public function release()
{
return $this->belongsTo('App\Models\Release', 'releases_id');
return $this->belongsTo(Release::class, 'releases_id');
}
}