Skip to content
Advertisement

Tag: laravel

How can I find the mix of 2 fields with a like in SQL/Laravel?

I have a table posts which contains posts (id field, candidate_id field and text field). I also have a candidate table (id, first_name, last_name). Now, I want to implement a method that would let me put some text, for example: “Mike Doe” and it would give me all the posts that contain “Mike Doe” or that the candidate first_name +

Sql select * from `categories` inner join `category_product` on `categories`.`id`

Look at my codes products migration web.php DetailsComponent.php Product.php details-component.blade.php I am trying to get specific data from the database by using column category_id when a user clicks a link but I am getting this error: I am showing categories for a product. I want to create a category manager section i have created the category manager but while i

How to create table with Foreign Keys in Laravel?

I have a users table and a roles table Now I want to create a user_role table which have two foreign keys But I’m getting an error: IlluminateDatabaseQueryException SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near

Files are repeated when uploading pictures to Laravel

I want to do bulk image upload on my blog that I write in Laravel. Wrote the code for loading images. Everything works, but the images are repeated After loading 6 images, I get this array of 21 elements. What’s wrong? Answer You’re appending $images to $urls on each image. Do it like this instead, appending images to $urls after

Laravel CRUD API Fatal Error: Trait ‘IlluminateDatabaseEloquentFactoriesHasFactory’ not found

I was following this tutorial, but with my own dataset: https://www.positronx.io/php-laravel-crud-operations-mysql-tutorial And I got stuck on the phase of Creating and storing data. After filling all the fields: Im getting this error: When I comment use HasFactory it’s showing this Please help! Answer The HasFactory trait wasn’t introduced until Laravel 8x. That’s also when they moved all the models into

Advertisement