app/Http/Controllers/RoleController.php
/**
     * Store a newly created role in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created role in storage.
Store a newly created role in storage .
public function store(RoleRequest $request)
    {
        $role = Role::create($request->except('permissions') + ['ts_register' => Carbon::now()->timestamp]);
        foreach ($request->all()['permissions'] as $value) {
            $role->permissions()->create(['module' => $value[0], 'type' => $value[2]]);
        }
        return redirect()->route('role.index')->with('store', 'New user role created');
    }
public function store ( RoleRequest $ request ) { $ role = Role :: create ( $ request -> except ( 'permissions' ) + [ 'ts_register' => Carbon :: now ( ) -> timestamp ] ) ; foreach ( $ request -> all ( ) [ 'permissions' ] as $ value ) { $ role -> permissions ( ) -> create ( [ 'module' => $ value [ 0 ] , 'type' => $ value [ 2 ] ] ) ; } return redirect ( ) -> route ( 'role.index' ) -> with ( 'store' , 'New user role created' ) ; }
Store a newly created role in storage.
Store a newly created role in storage .