userRepository = $userRepository; } public function index() { $data['editable'] = false; $data['users'] = $this->userRepository->findAll(); return view('user::user.index', $data); } /** * Show the form for creating a new resource. */ public function create() { $data['title'] = "Create User"; return view('user::user.create', $data); } /** * Store a newly created resource in storage. */ public function store(Request $request): RedirectResponse { $validatedData = $request->validate([ 'name' => 'required|min:5', 'email' => 'required', 'password' => 'required', ]); $user = $this->userRepository->create($validatedData, $request->role); toastr()->success('User has been created!'); return redirect()->route('user.index'); } /** * Show the specified resource. */ public function show($id) { $data['user'] = $this->userRepository->getUserById($id); return view('user::user.show'); } /** * Show the form for editing the specified resource. */ public function edit($id) { $data['title'] = "Edit User"; $data['user'] = $this->userRepository->getUserById($id); return view('user::user.edit', $data); } /** * Update the specified resource in storage. */ public function update(Request $request, $id): RedirectResponse { // } /** * Remove the specified resource from storage. */ public function destroy($id) { // } }