-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D | ||
* | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
* @author HDVinnie | ||
*/ | ||
|
||
namespace App\Models; | ||
|
||
use App\Traits\Auditable; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
/** | ||
* App\Models\Resolution. | ||
* | ||
* @property int $id | ||
* @property string $name | ||
* @property string $slug | ||
* @property int $position | ||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\TorrentRequest[] $requests | ||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Torrent[] $torrents | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newModelQuery() | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution newQuery() | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution query() | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereId($value) | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereName($value) | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution wherePosition($value) | ||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Resolution whereSlug($value) | ||
* @mixin \Eloquent | ||
* @property-read int|null $requests_count | ||
* @property-read int|null $torrents_count | ||
*/ | ||
class Resolution extends Model | ||
{ | ||
use Auditable; | ||
|
||
/** | ||
* Indicates If The Model Should Be Timestamped. | ||
* | ||
* @var bool | ||
*/ | ||
public $timestamps = false; | ||
|
||
/** | ||
* Has Many Torrents. | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | ||
*/ | ||
public function torrents() | ||
{ | ||
return $this->hasMany(Torrent::class); | ||
} | ||
|
||
/** | ||
* Has Many Torrent Requests. | ||
* | ||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | ||
*/ | ||
public function requests() | ||
{ | ||
return $this->hasMany(TorrentRequest::class); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
database/migrations/2020_06_06_185230_create_resolutions_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE. | ||
* | ||
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0 | ||
* The details is bundled with this project in the file LICENSE.txt. | ||
* | ||
* @project UNIT3D Community Edition | ||
* | ||
* @author HDVinnie <[email protected]> | ||
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 | ||
*/ | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateResolutionsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('resolutions', function (Blueprint $table) { | ||
$table->bigIncrements('id'); | ||
$table->string('name'); | ||
$table->string('slug'); | ||
$table->integer('position'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('resolutions'); | ||
} | ||
} |