import path add optional route parameters for document.
This commit is contained in:
parent
82c98b5f2a
commit
c6d6fffad0
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Common;
|
||||
|
||||
use App\Abstracts\Http\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Import extends Controller
|
||||
{
|
||||
@ -13,7 +14,7 @@ class Import extends Controller
|
||||
* @param $type
|
||||
* @return Response
|
||||
*/
|
||||
public function create($group, $type)
|
||||
public function create($group, $type, $route = null)
|
||||
{
|
||||
$path = $group . '/' . $type;
|
||||
|
||||
@ -23,6 +24,6 @@ class Import extends Controller
|
||||
$namespace = '';
|
||||
}
|
||||
|
||||
return view('common.import.create', compact('group', 'type', 'path', 'namespace'));
|
||||
return view('common.import.create', compact('group', 'type', 'path', 'route', 'namespace'));
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,20 @@
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
{!! Form::open([
|
||||
'url' => $path . '/import',
|
||||
@php
|
||||
$form_open = [
|
||||
'files' => true,
|
||||
'role' => 'form',
|
||||
'class' => 'form-loading-button'
|
||||
]) !!}
|
||||
];
|
||||
|
||||
if (!empty($route)) {
|
||||
$form_open['route'] = $route;
|
||||
} else {
|
||||
$form_open['url'] = $path . '/import';
|
||||
}
|
||||
@endphp
|
||||
{!! Form::open($form_open) !!}
|
||||
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
@ -41,7 +49,16 @@
|
||||
<div class="card-footer">
|
||||
<div class="row save-buttons">
|
||||
<div class="col-xs-12 col-sm-12">
|
||||
<a href="{{ url($path) }}" class="btn btn-outline-secondary">{{ trans('general.cancel') }}</a>
|
||||
@if (!empty($route))
|
||||
<a href="{{ route(\Str::replaceFirst('.import', '.index', $route)) }}" class="btn btn-outline-secondary">
|
||||
{{ trans('general.cancel') }}
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ url($path) }}" class="btn btn-outline-secondary">
|
||||
{{ trans('general.cancel') }}
|
||||
</a>
|
||||
@endif
|
||||
|
||||
{!! Form::button(trans('import.import'), ['type' => 'submit', 'class' => 'btn btn-success']) !!}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -28,7 +28,7 @@ Route::group(['prefix' => 'common'], function () {
|
||||
Route::post('widgets/getData', 'Common\Widgets@getData')->name('widgets.getData');
|
||||
Route::resource('widgets', 'Common\Widgets');
|
||||
|
||||
Route::get('import/{group}/{type}', 'Common\Import@create')->name('import.create');
|
||||
Route::get('import/{group}/{type}/{route?}', 'Common\Import@create')->name('import.create');
|
||||
|
||||
Route::get('items/autocomplete', 'Common\Items@autocomplete')->name('items.autocomplete');
|
||||
Route::post('items/total', 'Common\Items@total')->middleware(['money'])->name('items.total');
|
||||
|
Loading…
x
Reference in New Issue
Block a user