skip to Main Content

How to pass data to AppServiceProvider? – Laravel

I'm trying to pass the $product variable in this controller to multiple view files. function show($lang, $slug) { $product = Product::where('slug', $slug)->firstOrFail(); $mightAlsoLike = Product::where('slug', '!=', $slug)->MightAlsoLike()->get(); return view('shop_show')->with(['product' => $product, 'mightAlsoLike' => $mightAlsoLike]); } I'm using view composer in…

VIEW QUESTION

How to make default request values inside $validated array in Laravel?

Controller code: public function store(UserStoreRequest $request) { $validated = $request->validated(); $validated['user_type_id'] = 2; $validated['user_gender_id'] = $request->user_gender_id; $validated['last_login_at'] = Carbon::now(); $validated['password'] = Hash::make($request->password); User::create($validated); return to_route('all-users'); } Is there a better way to do this? I tried something like this but…

VIEW QUESTION

MVC join multiple tables with IEnumerable model – Asp.net

I am very very new to entity framework so I might have done terrible mistakes. I have two tables in database and I want to join these tables to show in one view page.My code: CompanyController using CompanyData.DAL; using Microsoft.AspNetCore.Mvc; using CompanyData.Models; namespace CompanyData.Controllers…

VIEW QUESTION
Back To Top
Search