/** * Store a newly created resource in storage. * * @return Response */ public function store(AdminRequest $request) { Role::create($request->all())->permissions()->sync($request->permissions); return redirect('roles/admin')->with('message', 'Role created!'); }
/** * Run the database seeds. * * @return void */ public function run() { Role::create(['name' => 'Admin', 'slug' => 'admin'])->permissions()->sync(Permission::all()->lists('id')->toArray()); Role::create(['name' => 'Editor', 'slug' => 'editor']); }