2018-01-29 12:41:57 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2018-02-01 23:10:08 +00:00
|
|
|
use Symfony\Component\ClassLoader\ClassMapGenerator;
|
2018-02-03 15:46:14 +00:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2018-02-01 23:10:08 +00:00
|
|
|
|
2018-01-29 12:41:57 +00:00
|
|
|
|
|
|
|
class Item extends Model
|
|
|
|
{
|
2018-02-03 15:46:14 +00:00
|
|
|
use SoftDeletes;
|
|
|
|
|
2018-01-29 12:41:57 +00:00
|
|
|
//
|
2018-02-01 14:45:59 +00:00
|
|
|
protected $fillable = [
|
2018-02-03 00:22:42 +00:00
|
|
|
'title', 'url', 'colour', 'icon', 'description', 'pinned', 'order'
|
2018-02-01 14:45:59 +00:00
|
|
|
];
|
2018-02-01 23:10:08 +00:00
|
|
|
|
2018-02-03 15:46:14 +00:00
|
|
|
/**
|
|
|
|
* The attributes that should be mutated to dates.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
|
2018-02-01 23:10:08 +00:00
|
|
|
public static function supportedList()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'NZBGet' => App\SupportedApps\Nzbget::class,
|
|
|
|
'Plex' => App\SupportedApps\Plex::class,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
public static function supportedOptions()
|
|
|
|
{
|
|
|
|
return array_keys(self::supportedList());
|
|
|
|
}
|
2018-02-03 00:22:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Scope a query to only include pinned items.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
|
|
|
* @return \Illuminate\Database\Eloquent\Builder
|
|
|
|
*/
|
|
|
|
public function scopePinned($query)
|
|
|
|
{
|
|
|
|
return $query->where('pinned', 1);
|
|
|
|
}
|
2018-01-29 12:41:57 +00:00
|
|
|
}
|