Convert Form facade

This commit is contained in:
Shift
2025-07-10 19:17:24 +00:00
parent e251f4f1bc
commit 638d2fe4a4
18 changed files with 49 additions and 51 deletions

View File

@@ -12,8 +12,6 @@ return [
'aliases' => Facade::defaultAliases()->merge([
'EnhancedApps' => App\EnhancedApps::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'SupportedApps' => App\SupportedApps::class,
'Yaml' => Symfony\Component\Yaml\Yaml::class,

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::open(array('route' => 'items.store', 'id' => 'itemform', 'files' => true, 'method'=>'POST')) !!}
{{ html()->form('POST', route('items.store'))->id('itemform')->acceptsFiles()->open() }}
@include('items.form')
{!! Form::close() !!}
{{ html()->form()->close() }}
@endsection
@section('scripts')

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::model($item, ['data-item-id' =>$item->id, 'method' => 'PATCH', 'id' => 'itemform', 'files' => true, 'route' => ['items.update', $item->id]]) !!}
{{ html()->modelForm($item, 'PATCH', route('items.update', $item->id))->data('item-id', $item->id)->id('itemform')->acceptsFiles()->open() }}
@include('items.form')
{!! Form::close() !!}
{{ html()->closeModelForm() }}
@endsection
@section('scripts')

View File

@@ -1,6 +1,6 @@
<div class="toggleinput">
<label class="name">{{ __('app.apps.enable') }}</label>
{!! Form::hidden('config[enabled]', '0') !!}
{{ html()->hidden('config[enabled]', '0') }}
<label class="switch">
<?php
$checked = false;

View File

@@ -5,7 +5,7 @@
<div class="module-actions">
<div class="toggleinput">
<label class="name">{{ __('app.apps.pinned') }}</label>
{!! Form::hidden('pinned', '0') !!}
{{ html()->hidden('pinned', '0') }}
<label class="switch">
<?php
$checked = true;
@@ -30,7 +30,7 @@
<div><button id="optdetails-button" class="dark">{{ __('app.apps.apptype') }}</button></div>
<div class="optvalue">
<div class="input">
{!! Form::select('appid', App\Application::applist(), null, array('class' => 'form-control config-item', 'id' => 'apptype', 'data-config' => 'type')) !!}
{{ html()->select('appid', App\Application::applist())->class('form-control config-item')->id('apptype')->data('config', 'type') }}
</div>
</div>
</div>
@@ -38,7 +38,7 @@
<div><button class="dark">{{ __('app.apps.website') }}</button></div>
<div class="optvalue">
<div class="input">
{!! Form::text('website', $item->url ?? null, array('placeholder' => __('app.apps.website'), 'id' => 'website', 'class' => 'form-control')) !!}
{{ html()->text('website', $item->url ?? null)->placeholder(__('app.apps.website'))->id('website')->class('form-control') }}
<small class="help">Don't forget http(s)://</small>
</div>
<div><button class="btn">Go</button></div>
@@ -58,29 +58,29 @@
{!! csrf_field() !!}
<div class="input">
<label>{{ __('app.apps.application_name') }} *</label>
{!! Form::text('title', null, array('placeholder' => __('app.apps.title'), 'id' => 'appname', 'class' => 'form-control', 'required')) !!}
{{ html()->text('title')->placeholder(__('app.apps.title'))->id('appname')->class('form-control')->required() }}
</div>
<div class="input">
<label>{{ __('app.apps.colour') }}</label>
{!! Form::text('colour', $item->colour ?? '#161b1f', array('placeholder' => __('app.apps.hex'), 'id' => 'appcolour', 'class' => 'form-control color-picker set-bg-elem')) !!}
{{ html()->text('colour', $item->colour ?? '#161b1f')->placeholder(__('app.apps.hex'))->id('appcolour')->class('form-control color-picker set-bg-elem') }}
</div>
<div class="input">
<label>{{ strtoupper(__('app.url')) }} *</label>
{!! Form::text('url', $item->url ?? null, array('placeholder' => __('app.url'), 'id' => 'appurl', 'class' => 'form-control', 'required')) !!}
{{ html()->text('url', $item->url ?? null)->placeholder(__('app.url'))->id('appurl')->class('form-control')->required() }}
<small class="help">Don't forget http(s)://</small>
</div>
<div class="input">
<label>{{ __('app.apps.tags') }} ({{ __('app.optional') }})</label>
{!! Form::select('tags[]', $tags, $current_tags, ['class' => 'tags', 'multiple']) !!}
{{ html()->multiselect('tags[]', $tags, $current_tags)->class('tags') }}
</div>
@if($app['config']->get('app.auth_roles_enable', false))
<div class="input">
<label>{{ __('app.role') }}</label>
{!! Form::text('role', $item->role ?? null, array('placeholder' => __('app.role'), 'id' => 'role', 'class' => 'form-control')) !!}
{{ html()->text('role', $item->role ?? null)->placeholder(__('app.role'))->id('role')->class('form-control') }}
</div>
@endif
@@ -93,7 +93,7 @@
else $icon = old('icon');
?>
<img src="{{ asset('storage/'.$icon) }}" />
{!! Form::hidden('icon', $icon, ['class' => 'form-control']) !!}
{{ html()->hidden('icon', $icon)->class('form-control') }}
@else
<img src="{{ asset('/img/heimdall-icon-small.png') }}" />
@endif

View File

@@ -37,9 +37,9 @@
<td>{{ $app->getTagList() }}</td>
<td class="text-center"><a{{ $app->target }} href="{!! route('items.edit', [$app->id]) !!}" title="{{ __('app.settings.edit') }} {{ $app->title }}"><i class="fas fa-edit"></i></a></td>
<td class="text-center">
{!! Form::open(['method' => 'DELETE','route' => ['items.destroy', $app->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('items.destroy', $app->id))->style('display:inline')->open() }}
<button class="link" type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
</td>
</tr>
@endforeach

View File

@@ -28,10 +28,10 @@
<td>{{ __('app.url') }}</td>
<td class="text-center"><a href="{!! route('items.restore', [$app->id]) !!}" title="{{ __('app.restore') }} {!! $app->title !!}"><i class="fas fa-undo"></i></a></td>
<td class="text-center">
{!! Form::open(['method' => 'DELETE','route' => ['items.destroy', $app->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('items.destroy', $app->id))->style('display:inline')->open() }}
<input type="hidden" name="force" value="1" />
<button type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
</td>
</tr>
@endforeach

View File

@@ -2,8 +2,8 @@
@section('content')
{!! Form::model($setting, ['method' => 'PATCH', 'files' => true, 'route' => ['settings.edit', $setting->id]]) !!}
{{ html()->modelForm($setting, 'PATCH', route('settings.edit', $setting->id))->acceptsFiles()->open() }}
@include('settings.form')
{!! Form::close() !!}
{{ html()->closeModelForm() }}
@endsection

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::open(array('route' => 'tags.store', 'id' => 'itemform', 'files' => true, 'method'=>'POST')) !!}
{{ html()->form('POST', route('tags.store'))->id('itemform')->acceptsFiles()->open() }}
@include('tags.form')
{!! Form::close() !!}
{{ html()->form()->close() }}
@endsection
@section('scripts')

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::model($item, ['method' => 'PATCH', 'id' => 'itemform', 'files' => true, 'route' => ['tags.update', $item->id]]) !!}
{{ html()->modelForm($item, 'PATCH', route('tags.update', $item->id))->id('itemform')->acceptsFiles()->open() }}
@include('tags.form')
{!! Form::close() !!}
{{ html()->closeModelForm() }}
@endsection
@section('scripts')

View File

@@ -12,10 +12,10 @@
<div class="input">
<label>{{ __('app.apps.tag_name') }} *</label>
{!! Form::text('title', null, array('placeholder' => __('app.apps.title'), 'class' => 'form-control', 'required')) !!}
{{ html()->text('title')->placeholder(__('app.apps.title'))->class('form-control')->required() }}
<hr />
<label>{{ __('app.apps.pinned') }}</label>
{!! Form::hidden('pinned', '0') !!}
{{ html()->hidden('pinned', '0') }}
<label class="switch">
<?php
$checked = true;
@@ -28,13 +28,13 @@
</div>
<div class="input">
<label>{{ __('app.apps.colour') }}</label>
{!! Form::text('colour', null, array('placeholder' => __('app.apps.hex'),'class' => 'form-control color-picker')) !!}
{{ html()->text('colour')->placeholder(__('app.apps.hex'))->class('form-control color-picker') }}
<hr />
</div>
@if($app['config']->get('app.auth_roles_enable', false))
<div class="input">
<label>{{ __('app.role') }}</label>
{!! Form::text('role', $item->role ?? null, array('placeholder' => __('app.role'), 'id' => 'role', 'class' => 'form-control')) !!}
{{ html()->text('role', $item->role ?? null)->placeholder(__('app.role'))->id('role')->class('form-control') }}
<hr />
</div>
@endif
@@ -48,7 +48,7 @@
else $icon = old('icon');
?>
<img src="{{ asset('storage/'.$icon) }}" />
{!! Form::hidden('icon', $icon, ['class' => 'form-control']) !!}
{{ html()->hidden('icon', $icon)->class('form-control') }}
@else
<img src="/img/heimdall-icon-small.png" />
@endif
@@ -61,7 +61,7 @@
</div>
<div class="input">
<label>{{ __('app.apps.pinned') }}</label>
{!! Form::hidden('pinned', '0') !!}
{{ html()->hidden('pinned', '0') }}
<label class="switch">
<?php
$checked = false;

View File

@@ -34,9 +34,9 @@
<td><a{{ $app->target }} href="{{ url($app->link) }}">{{ $app->link }}</a></td>
<td class="text-center"><a href="{!! route('tags.edit', [$app->id]) !!}" title="{{ __('app.settings.edit') }} {{ $app->title }}"><i class="fas fa-edit"></i></a></td>
<td class="text-center">
{!! Form::open(['method' => 'DELETE','route' => ['tags.destroy', $app->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('tags.destroy', $app->id))->style('display:inline')->open() }}
<button class="link" type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
</td>
</tr>
@endforeach

View File

@@ -28,10 +28,10 @@
<td>{{ __('app.url') }}</td>
<td class="text-center"><a href="{!! route('tags.restore', [ $app->id ]) !!}" title="{{ __('app.restore') }} {!! $app->title !!}"><i class="fas fa-undo"></i></a></td>
<td class="text-center">
{!! Form::open(['method' => 'DELETE','route' => ['tags.destroy', $app->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('tags.destroy', $app->id))->style('display:inline')->open() }}
<input type="hidden" name="force" value="1" />
<button type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
</td>
</tr>
@endforeach

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::open(array('route' => 'users.store', 'id' => 'userform', 'files' => true, 'method'=>'POST')) !!}
{{ html()->form('POST', route('users.store'))->id('userform')->acceptsFiles()->open() }}
@include('users.form')
{!! Form::close() !!}
{{ html()->form()->close() }}
@endsection
@section('scripts')

View File

@@ -2,9 +2,9 @@
@section('content')
{!! Form::model($user, ['method' => 'PATCH', 'id' => 'userform', 'files' => true, 'route' => ['users.update', $user->id]]) !!}
{{ html()->modelForm($user, 'PATCH', route('users.update', $user->id))->id('userform')->acceptsFiles()->open() }}
@include('users.form')
{!! Form::close() !!}
{{ html()->closeModelForm() }}
@endsection
@section('scripts')

View File

@@ -12,12 +12,12 @@
<div class="input">
<label>{{ __('app.user.username') }} *</label>
{!! Form::text('username', null, array('placeholder' => __('app.user.username'), 'id' => 'appname', 'class' => 'form-control')) !!}
{{ html()->text('username')->placeholder(__('app.user.username'))->id('appname')->class('form-control') }}
<hr />
</div>
<div class="input">
<label>{{ __('app.user.email') }} *</label>
{!! Form::text('email', null, array('placeholder' => 'email@test.com','class' => 'form-control')) !!}
{{ html()->text('email')->placeholder('email@test.com')->class('form-control') }}
<hr />
</div>
<div class="input">
@@ -30,7 +30,7 @@
else $avatar = old('avatar');
?>
<img style="max-width: 115px" src="{{ asset('storage/'.$avatar) }}" />
{!! Form::hidden('avatar', $avatar, ['class' => 'form-control']) !!}
{{ html()->hidden('avatar', $avatar)->class('form-control') }}
@else
<img style="max-width: 115px" src="/img/heimdall-icon-small.png" />
@endif
@@ -45,19 +45,19 @@
<div style="margin-top: -40px; width: 100%; padding: 0" class="create">
<div class="input">
<label>{{ __('app.apps.password') }} *</label>
{!! Form::password('password', null, array('class' => 'form-control')) !!}
{{ html()->password('password', array('class' => 'form-control'))->attributes(null) }}
<hr />
</div>
<div class="input">
<label>{{ __('app.user.password_confirm') }} *</label>
{!! Form::password('password_confirmation', null, array('class' => 'form-control')) !!}
{{ html()->password('password_confirmation', array('class' => 'form-control'))->attributes(null) }}
</div>
</div>
<div class="input">
<label>{{ __('app.user.secure_front') }}</label>
{!! Form::hidden('public_front', '0') !!}
{{ html()->hidden('public_front', '0') }}
<label class="switch">
<?php
$checked = true;
@@ -70,7 +70,7 @@
</div>
<div class="input">
<label>{{ __('app.user.autologin') }}</label>
{!! Form::hidden('autologin_allow', '0') !!}
{{ html()->hidden('autologin_allow', '0') }}
<label class="switch">
<?php
$checked = false;

View File

@@ -43,9 +43,9 @@
<td class="text-center"><a{{ $user->target }} href="{!! route('users.edit', [$user->id]) !!}" title="{{ __('user.settings.edit') }} {!! $user->title !!}"><i class="fas fa-edit"></i></a></td>
<td class="text-center">
@if($user->id !== 1)
{!! Form::open(['method' => 'DELETE','route' => ['users.destroy', $user->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('users.destroy', $user->id))->style('display:inline')->open() }}
<button class="link" type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
@endif
</td>
</tr>

View File

@@ -28,10 +28,10 @@
<td>{{ __('app.url') }}</td>
<td class="text-center"><a href="{!! route('items.restore', [$app->id]) !!}" title="{{ __('app.restore') }} {!! $app->title !!}"><i class="fas fa-undo"></i></a></td>
<td class="text-center">
{!! Form::open(['method' => 'DELETE','route' => ['items.destroy', $app->id],'style'=>'display:inline']) !!}
{{ html()->form('DELETE', route('items.destroy', $app->id))->style('display:inline')->open() }}
<input type="hidden" name="force" value="1" />
<button type="submit"><i class="fa fa-trash-alt"></i></button>
{!! Form::close() !!}
{{ html()->form()->close() }}
</td>
</tr>
@endforeach