FEATURE #1368: add form for creating new custom field
Currently, form is not saved, however it is validated.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Requests\NewCustomFieldRequest;
|
||||
|
||||
class CreateNewCustomField extends Controller
|
||||
{
|
||||
public function getNew()
|
||||
{
|
||||
$types = [];
|
||||
|
||||
return view('admin.customFields.new', ['types' => $types]);
|
||||
}
|
||||
|
||||
public function postNew(NewCustomFieldRequest $request)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
class NewCustomFieldRequest extends Request
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'type' => 'required|exists:custom_field_types',
|
||||
'minLength' => 'numeric|min:0',
|
||||
'maxLength' => 'numeric|mix:0'
|
||||
];
|
||||
}
|
||||
}
|
||||
+11
-2
@@ -48,11 +48,20 @@ Route::group([
|
||||
Route::get('users/overview/{state?}', 'UsersOverview@getOverview')
|
||||
->name('users.overview');
|
||||
|
||||
|
||||
// custom fields
|
||||
// ------------------------------
|
||||
Route::get('customfields/overview', 'CustomFieldsOverview@getOverview')->name('customfields.overview');
|
||||
|
||||
// list of all custom fields
|
||||
Route::get('customfields/overview', 'CustomFieldsOverview@getOverview')
|
||||
->name('customfields.overview');
|
||||
|
||||
// form for adding new custom field
|
||||
Route::get('customfields/new', 'CreateNewCustomField@getNew')
|
||||
->name('customfields.new');
|
||||
|
||||
// form for adding new custom field
|
||||
Route::post('customfields/new', 'CreateNewCustomField@postNew')
|
||||
->name('customfields.newPost');
|
||||
|
||||
// logout method
|
||||
Route::get('logout', function () {
|
||||
|
||||
@@ -33,7 +33,8 @@ class AdminMenusProvider extends ServiceProvider
|
||||
|
||||
}, 20, ['icon' => 'fa fa-users']);
|
||||
$menu->dropdown(trans('admin/mainMenu.customFields'), function ($sub) {
|
||||
$sub->route('customfields.overview', trans('admin/mainMenu/customFieldsOverview'), [], 50, ['icon' => 'fa code-fork']);
|
||||
$sub->route('customfields.new', trans('admin/mainMenu.customFieldsNew'), [], 10, ['icon' => 'fa fa-code']);
|
||||
$sub->route('customfields.overview', trans('admin/mainMenu.customFieldsOverview'), [], 50, ['icon' => 'fa fa-code-fork']);
|
||||
}, 30, ['icon' => 'fa fa-code']);
|
||||
$menu->url('#', trans('admin/mainMenu.settings'), 50, ['icon' => 'fa fa-gear']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user