Skip to content

Tag: laravel

Laravel 9 with argument 2 must be of type ?callable, string given

I’m following a tutorial. In the controller I’m using with to send a success message. I’m getting an error message once the form is submitted and I’m redirected to the index page the code there looks like this. This is the error message: with(): Argument #2 ($callback) must be of type …

Data output from the database

I have a select and I want to output data from the DB In CreateController I wrote this I have a UserGuild database And I have such a mistake I need to output to select what is in the User Guide database, but at the same time where {{$guild->name}}and value were were values from the Guild database I also tr…

Laravel : Combine two tables using Model relations

i have two tables :: shops and attachments . Shops has all the details for shop and attachments with all the pictures for shop with ref_id as FK . now for mobile app i have to list shops with Shop title and one image. I can achieve it using leftjoin as below. This returns just shop name and pictures ,

Laravel API controller return object along with other arguments

In API controller index function $response holds id’s of media items from db table And if $is_published_pack == ‘false’ I’m successfully returning How to append $response inside when $is_published_pack true condition is met? $response value is I’ve tried for example doing this bu…