src/Controllers/QuickadminMenuController.php
public function insertParent(Request $request)
    {
        $validation = Validator::make($request->all(), [
            'title' => 'required',
        ]);
        if ($validation->fails()) {
            return redirect()->back()->withInput()->withErrors($validation);
        }
        $menu = Menu::create([
            'position'  => 0,
            'menu_type' => 2,
            'icon'      => $request->icon != '' ? $request->icon : 'fa-database',
            'name'      => ucfirst(camel_case($request->title)),
            'title'     => $request->title,
            'parent_id' => null,
        ]);
        $menu->roles()->sync($request->input('roles', []));

        return redirect()->route('menu');
    }
public function insertParent(Request $request)
    {
        $validation = Validator::make($request->all(), [
            'title' => 'required',
        ]);
        if ($validation->fails()) {
            return redirect()->back()->withInput()->withErrors($validation);
        }
        $menu = Menu::create([
            'position'  => 0,
            'menu_type' => 2,
            'icon'      => $request->icon != '' ? $request->icon : 'fa-database',
            'name'      => ucfirst(camel_case($request->title)),
            'title'     => $request->title,
            'parent_id' => null,
        ]);
        $menu->roles()->sync($request->input('roles', []));

        return redirect()->route('menu');
    }
public function insertParent ( Request $ request ) { $ validation = Validator :: make ( $ request -> all ( ) , [ 'title' => 'required' , ] ) ; if ( $ validation -> fails ( ) ) { return redirect ( ) -> back ( ) -> withInput ( ) -> withErrors ( $ validation ) ; } $ menu = Menu :: create ( [ 'position' => 0 , 'menu_type' => 2 , 'icon' => $ request -> icon != '' ? $ request -> icon : 'fa-database' , 'name' => ucfirst ( camel_case ( $ request -> title ) ) , 'title' => $ request -> title , 'parent_id' => null , ] ) ; $ menu -> roles ( ) -> sync ( $ request -> input ( 'roles' , [ ] ) ) ; return redirect ( ) -> route ( 'menu' ) ; }
Insert our fresh parent page

@param Request $request

@return \Illuminate\Http\RedirectResponse
Insert our fresh parent page