/** * @param StoreUserRequest $request * @return mixed */ public function store(StoreUserRequest $request) { $this->users->create($request->except('assignees_roles', 'permission_user'), $request->only('assignees_roles'), $request->only('permission_user')); return redirect()->route('admin.access.users.index')->withFlashSuccess(trans('alerts.backend.users.created')); }
/** * @param StoreUserRequest $request * @return mixed */ public function store(StoreUserRequest $request) { // $this->users->create( // $request->except('assignees_roles', 'permission_user'), // $request->only('assignees_roles'), // $request->only('permission_user') // ); $getID = $price = DB::table('users')->max('id'); if (Input::get('phi_ref_number') != null) { User::create($request->all()); DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '24', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]); } elseif (Input::get('moh_ref_number') != null) { User::create($request->all()); DB::table('permission_user')->insert(['permission_id' => '6', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '2', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '25', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '4', 'user_id' => $getID + 1]); DB::table('permission_user')->insert(['permission_id' => '1', 'user_id' => $getID + 1]); } return redirect()->route('admin.access.users.index')->withFlashSuccess(trans("alerts.users.created")); }