Skip to content
Advertisement

Tag: laravel

Laravel 8 job Cannot pass parameter 1 by reference error

I’m working with a Laravel 8 project and have created a Job that gets processed. I’ve got several functions to extract functionality but am getting the following error: Cannot pass parameter 1 by reference The trace is initially saying on line 65, which would be ‘title’ => $page->header ?? “Page $key” but I’m not sure what I’m missing here? My

Undefined index , Unable to fetch columns- Laravel

In the above code, Notifications is the model Name. Getting the error Undefined index: notificationTypeName when trying to access column notificationTypeName of the array $data. dd($data) gives an ouput as below: Answer The all method returns the underlying array represented by the collection: see this : https://laravel.com/docs/8.x/collections#method-all so try with this: with foreach

Laravel SEO friendly URLs

I started learning laravel and couldn’t figure out how to solve a problem. For example if i want to create a route for products i can use a route like below. In this approach we would get something like this localhost/product/macbook-pro. However i want to create a url like localhost/macbook-pro. In my project, where I did this with plain PHP

Can’t get Session in controller

I want to alert notify after sent message! I try to get session message after sent in controller but it not working. here my controller code : Answer Use the helpers: for inserting and making seesion : for catch and using the session :

How to sort numbers containing current year in prefix

I am having trouble sorting the job numbers in my project. My client requirement is to store the job numbers in the below format:- For example:- The current year is 2021 so the job number will be like this:- When the year changes it should start again from 1 and so on for the next year. For example:- I had

Advertisement