Initial upload icon support
This commit is contained in:
parent
daa7079b0c
commit
e32d9609e7
|
@ -4,8 +4,8 @@ namespace App\Http\Controllers;
|
|||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Item;
|
||||
//use App\SupportedApps\Contracts\Applications;
|
||||
use App\SupportedApps\Nzbget;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ItemController extends Controller
|
||||
{
|
||||
|
@ -60,6 +60,13 @@ class ItemController extends Controller
|
|||
'url' => 'required',
|
||||
]);
|
||||
|
||||
if($request->hasFile('file')) {
|
||||
$path = $request->file('file')->store('icons');
|
||||
$request->merge([
|
||||
'icon' => $path
|
||||
]);
|
||||
}
|
||||
|
||||
Item::create($request->all());
|
||||
|
||||
return redirect()->route('dash')
|
||||
|
@ -107,6 +114,14 @@ class ItemController extends Controller
|
|||
'url' => 'required',
|
||||
]);
|
||||
|
||||
if($request->hasFile('file')) {
|
||||
$path = $request->file('file')->store('icons');
|
||||
$request->merge([
|
||||
'icon' => $path
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Item::find($id)->update($request->all());
|
||||
|
||||
return redirect()->route('dash')
|
||||
|
|
|
@ -18,6 +18,7 @@ class AppServiceProvider extends ServiceProvider
|
|||
// first time setup
|
||||
touch(database_path(env('DB_DATABASE')));
|
||||
Artisan::call('migrate', array('--path' => 'database/migrations', '--force' => true));
|
||||
Artisan::call('storage:link');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||
'default' => env('FILESYSTEM_DRIVER', 'public'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<section class="item-container">
|
||||
<div class="item" style="background-color: {{ $app->colour }}">
|
||||
@if($app->icon)
|
||||
<img src="" />
|
||||
<img src="{{ asset('storage/'.$app->icon) }}" />
|
||||
@else
|
||||
<i class="fas fa-app-store-ios"></i>
|
||||
@endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
{!! Form::open(array('route' => 'items.store','method'=>'POST')) !!}
|
||||
{!! Form::open(array('route' => 'items.store', 'files' => true, 'method'=>'POST')) !!}
|
||||
@include('items.form')
|
||||
{!! Form::close() !!}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
@section('content')
|
||||
|
||||
{!! Form::model($item, ['method' => 'PATCH','route' => ['items.update', $item->id]]) !!}
|
||||
{!! Form::model($item, ['method' => 'PATCH', 'files' => true, 'route' => ['items.update', $item->id]]) !!}
|
||||
@include('items.form')
|
||||
{!! Form::close() !!}
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
</header>
|
||||
<div class="create">
|
||||
{!! csrf_field() !!}
|
||||
<div class="input">
|
||||
<!--<div class="input">
|
||||
<label>Application name</label>
|
||||
{!! Form::select('supported', \App\Item::supportedOptions(), array('placeholder' => 'Title','class' => 'form-control')) !!}
|
||||
</div>
|
||||
</div>-->
|
||||
|
||||
<div class="input">
|
||||
<label>Application name</label>
|
||||
|
@ -25,6 +25,29 @@
|
|||
<label>URL</label>
|
||||
{!! Form::text('url', null, array('placeholder' => 'Url','class' => 'form-control')) !!}
|
||||
</div>
|
||||
|
||||
<div class="input">
|
||||
<label>Icon *</label>
|
||||
@if(isset($item->icon) && !empty($item->icon))
|
||||
{{ asset('storage/'.$item->icon) }}
|
||||
{!! Form::hidden('icon', $item->icon, ['class' => 'form-control']) !!}
|
||||
@endif
|
||||
<input name="file" type="file" class="form-control">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<label class="switch">
|
||||
<?php
|
||||
$checked = false;
|
||||
if(isset($item->pinned) && $item->pinned === 1) $checked = true;
|
||||
$set_checked = ($checked) ? ' checked="checked"' : '';
|
||||
?>
|
||||
<input type="checkbox" name="active" value="1"<?php echo $set_checked;?> />
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
|
Loading…
Reference in a new issue