initial support for supported applications

This commit is contained in:
KodeStar 2018-02-01 23:10:08 +00:00
parent 41850f72df
commit daa7079b0c
8 changed files with 54 additions and 0 deletions

View file

@ -4,6 +4,8 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Item;
//use App\SupportedApps\Contracts\Applications;
use App\SupportedApps\Nzbget;
class ItemController extends Controller
{
@ -19,6 +21,7 @@ class ItemController extends Controller
return view('welcome', $data);
}
/**
* Display a listing of the resource.
*

View file

@ -3,6 +3,9 @@
namespace App;
use Illuminate\Database\Eloquent\Model;
use Symfony\Component\ClassLoader\ClassMapGenerator;
class Item extends Model
{
@ -10,4 +13,16 @@ class Item extends Model
protected $fillable = [
'title', 'url', 'colour', 'icon', 'description', 'pinned'
];
public static function supportedList()
{
return [
'NZBGet' => App\SupportedApps\Nzbget::class,
'Plex' => App\SupportedApps\Plex::class,
];
}
public static function supportedOptions()
{
return array_keys(self::supportedList());
}
}

View file

@ -0,0 +1,7 @@
<?php namespace App\SupportedApps\Contracts;
interface Applications {
public function defaultColour();
}

View file

@ -0,0 +1,8 @@
<?php namespace App\SupportedApps;
class Nzbget implements Contracts\Applications {
public function defaultColour()
{
return '#ccc';
}
}

View file

@ -0,0 +1,8 @@
<?php namespace App\SupportedApps;
class Plex implements Contracts\Applications {
public function defaultColour()
{
return '#ccc';
}
}

View file

@ -8,6 +8,11 @@
</header>
<div class="create">
{!! csrf_field() !!}
<div class="input">
<label>Application name</label>
{!! Form::select('supported', \App\Item::supportedOptions(), array('placeholder' => 'Title','class' => 'form-control')) !!}
</div>
<div class="input">
<label>Application name</label>
{!! Form::text('title', null, array('placeholder' => 'Title','class' => 'form-control')) !!}

View file

@ -26,6 +26,10 @@ return array(
'App\\Providers\\BroadcastServiceProvider' => $baseDir . '/app/Providers/BroadcastServiceProvider.php',
'App\\Providers\\EventServiceProvider' => $baseDir . '/app/Providers/EventServiceProvider.php',
'App\\Providers\\RouteServiceProvider' => $baseDir . '/app/Providers/RouteServiceProvider.php',
'App\\Providers\\SupportedServiceProvider' => $baseDir . '/app/Providers/SupportedServiceProvider.php',
'App\\SupportedApps\\Contracts\\Applications' => $baseDir . '/app/SupportedApps/Contracts/Applications.php',
'App\\SupportedApps\\Nzbget' => $baseDir . '/app/SupportedApps/Nzbget.php',
'App\\SupportedApps\\Plex' => $baseDir . '/app/SupportedApps/Plex.php',
'App\\User' => $baseDir . '/app/User.php',
'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',

View file

@ -337,6 +337,10 @@ class ComposerStaticInit4b6fb9210a1ea37c2db27b8ff53a1ecf
'App\\Providers\\BroadcastServiceProvider' => __DIR__ . '/../..' . '/app/Providers/BroadcastServiceProvider.php',
'App\\Providers\\EventServiceProvider' => __DIR__ . '/../..' . '/app/Providers/EventServiceProvider.php',
'App\\Providers\\RouteServiceProvider' => __DIR__ . '/../..' . '/app/Providers/RouteServiceProvider.php',
'App\\Providers\\SupportedServiceProvider' => __DIR__ . '/../..' . '/app/Providers/SupportedServiceProvider.php',
'App\\SupportedApps\\Contracts\\Applications' => __DIR__ . '/../..' . '/app/SupportedApps/Contracts/Applications.php',
'App\\SupportedApps\\Nzbget' => __DIR__ . '/../..' . '/app/SupportedApps/Nzbget.php',
'App\\SupportedApps\\Plex' => __DIR__ . '/../..' . '/app/SupportedApps/Plex.php',
'App\\User' => __DIR__ . '/../..' . '/app/User.php',
'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php',
'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php',