Need help unit testing my views and not sure how to test it. Route::group([‘middleware’ => [‘guest’]], function(){ // Home page Route::get(‘/home’, ‘[email protected]’); Route::get(‘/homepage’, ‘[email protected]’); Route::get(‘/welcome’, ‘[email protected]’); // register page Route::get(‘/register’, ‘[email protected]’); Route::get(‘/semester’, ‘[email protected]’); }); Sourc..

Read more

I am using laravel policies to authenticate user actions on an application backend which was built using laravel nova. I am also using spatie permissions and roles package https://spatie.be/docs/laravel-permission/v3/introduction in this project. I have a UserTransactionPolicy which allows users with certain roles view a user’s transactions and only those with a certain permission. public function ..

Read more

how are you ? I’m using Guzzle to send post method but when i tried to send the post method with variable getting error so i tried to convert it to sting but still same this is my current code $user = Auth::user(); $mobile = $user->mobile; $client = new Client(); $booking = Booking::where(‘id’, ‘=’, e($id))->first(); ..

Read more

I’m trying to fetch some records if a certain condition is met, but am having trouble building the correct query. Here’s my example code: // $stars_selected = "4" $brokers = Broker::query() ->with(‘avgScore’); // example will returns 3.5 ->paginate(10) ->withQueryString(); Now, let’s say I have another variable present $stars_selected = "4", and I only want to ..

Read more

I’m fairly new to Laravel, but I’m trying to make a small API for my course. I’ve got this route Route::get(‘films/search’, ‘[email protected]’); which calls my custom function search which get as a parameter a Request. Here it is: public function search(Request $request) { $keyword = $request->input(‘keyword’); $rating = $request->input(‘rating’); $minLength = $request->input(‘minLength’); $maxLength = $request->input(‘maxLength’); ..

Read more

I am importing from Excel into database using Laravel-5.8 and Maatwebsites-3.1: public function importGrade(Request $request){ $request->validate([ ‘file’ => ‘required|max:10000|mimes:xlsx,xls’, ]); $path1 = $request->file(‘file’)->store(‘import’); $path=storage_path(‘app’).’/’.$path1; $import = new GradeLevelsImport; $import->import($path); if ($import->failures()->isNotEmpty()) { Session::flash(‘failure’, $import->failures()); return redirect()->route(‘hr.grades.index’); } Session::flash(‘success’, ‘Grade Records Imported Successfully’); return redirect()->route(‘hr.grades.index’); } $import->failures() has 4 items: row(), attribute(), errors() and errors() as ..

Read more

I would like to use Vue 3 components/vue files within Blade Templates. I have been spending the whole day trying to get it working, so this is my last hope.I tried watching video tutorials, I tried reading the documentation, I have tried pretty much everything. I first tried to install Vue using npm: npm install ..

Read more

Having the next request with Axios in VueJS axios.post(‘route-of-the-method’), { data, }).then((res) => { self.$vs.notification({ title: this.$page.props.language.section.success, text: this.$page.props.language.section.action_done, }); … Then the response from the controller is the next: return response()->json(true); So looks quite simple, it should to launch the notification properly, but it crashes because vue cannot read the shaded props from inertia. ..

Read more

I’m passing an array of json objects through the request to be validated in the controller: Controller public function store(Request $request) { $this->validate($request, [ ‘situation’ => ‘required’, ]); $emotions= [‘data’ => $request->input(’emotions’)]; $emotionsValidation = IlluminateSupportFacadesValidator::make($emotions, [ ‘data.*.id’ => ‘integer|between:1,70’, ‘data.*.intensity’ => ‘integer|between:0,100’, ‘data.*.new_intensity’ => ‘integer|between:0,100’ ]); if($emotionsValidation->fails()) { return response([‘error’ => ‘There was a problem ..

Read more

Been trying to find a way to call to pass a multidimensional array to a Post route with no success: The array looks like this: "order" => array:16 [ "id" => "1" "total" => "4825" "neighborhood" => "Barrio Bravo" ] "products" => array:2 [ 4 => array:4 [ "id" => "4" "name" => "Maestro Dobel ..

Read more