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 +
Tag: laravel
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
Laravel migration: “Foreign key constraint is incorrectly formed”)
My migration fails when I try to execute php artisan migrate or php artisan migrate:refresh with this error: Code Users Table (migrated successfully) Address Table (fails with error) Answer One of the reasons to work with a framework such as Laravel is syntactic sugar. By following their conventions, you write less code and have to think about fewer of the
Why is my $items doesn’t hold a group of $item? Laravel 8 Ecommerce
I’m from the same post here but I’ve found the root problem why is my quantity won’t increment but I don’t know how to solve this. The problem is at my isset function (in Cart.php), because I tried to echo something there and just realized the function isn’t running. This is the error pops up when I removed isset function
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
I want to show roles related to users in selection option using laravel
I am trying to show roles which is related to user but unfortunately userRoles are not showing related to user in selection option, please help me how can I match that thanks. Note :- I am using …
Conflicts with another require in Laravel spatie package
I have tried to install a spatie package in my laravel project, But I got error like this Please help how i can solve this. Answer Install version 5.8 of spatie sitemap by running below code
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
Laravel app interacting with a 3rd party API to get a token
I have one Laravel app with a GUI where the user logs in based on the data from a MySQL database. When the user logs in, the server needs to make a request to a specific endpoint of a 3rd party API in …