with('categories', DealCategory::all('id', 'name')); } /** * Store a newly created resource in storage. */ public function store(StoreBrokerDeal $request) { $data = $request->validated(); $data['slug'] = Str::slug($data['title']); $data['user_id'] = $request->user()->id; $path = ''; if($request->hasFile('image')){ $image = $request->file('image'); $path = $image->storeAs('images/deals', $data['slug'] . '.' . $image->extension(), 'public'); } $data['image'] = $path; Deal::unguard(); Deal::create($data); Deal::reguard(); return to_route('broker.dashboard')->with('success', 'Deal has been created.'); } /** * Display the specified resource. */ public function show(string $id) { // } /** * Show the form for editing the specified resource. */ public function edit(string $id) { // } /** * Update the specified resource in storage. */ public function update(Request $request, string $id) { // } /** * Remove the specified resource from storage. */ public function destroy(string $id) { // } }