Fairly new to Laravel and tried to make a Login page. Edit 2: Tried to use Guard and when I’m redirected to RedirectIfAuthenticated it seems somehow the auth()->check() or Auth::check() return false at handle function here’s my RedirectIfAuthenticated.php The Auth was able to store the user, bu…
Tag: laravel
Laravel 8: How to insert unique data from the DB
I need to insert some unique content into the DB using Laravel 8. Here is my code: As you can see the field numbers should stored unique numbers but I have some duplicated Hex values and I don’t want to store them at the DB. So how can I insert UNIQUE values into the DB. Note that I have already
Losing session data after POST from third party website
I have a Laravel site that redirects to a payment provider (external third party website). When the user completes their payment, they are redirected back to my site via a POST request. The issue I’m having is that the user’s session is lost when they return to the confirmation page. I wondered if…
Determine selected options based on many-to-many relationship
I have three tables: products, categories and category_product. In my edit form page I’m displaying the categories and subcategories values in a select box. The chosen category options are saved in the pivot table category_product. This table has product_id and category_id. Here’s my code. Product…
How to send multiple data into view with their required relationships
I am working on a Laravel 5.8 project which is an Online Store. and in this project, I wanted to add “Printing Order Factors” feature for Admins. So I have made a form like this: So basically admins can select multiple orders like this: And I’m trying to send order ids as an array: <input…
Best way of deleting multiple records linked in different tables in Laravel query builder
I’ve got a function in my Laravel 8 API that deletes a user’s account, it also deletes any of data in any other table where their user_id matches the one of the account that’s being deleted. One thing has become apparant quite quickly with this, is how can this be scaled, and whether there&#…
How to make relationship between three table in laravel eloquent
I have three tables, Sections,Questions and options. Each Section has many questions and each question has many options. How can I fetch data from this tables related to each other? Section model relationship with Question model Question model relationship with Option model: my query: It returns this: I want …
Undefined variable $credentials, tried several solutions but couldn’t understand my mistake
I’m a beginner, learning Laravel. I was trying to create a web page which will show me my login Info(like email and password) once I log in. In my controller part I passed values using route parameter, but when I call it in blade, it shows ErrorException Undefined variable $credentials (View: …..n…
how to get laravel to get back to the profile page after follow/unfollow happens
I am developing a social network website and one of the functions is followed and unfollow that get you to follow/unfollow another user on the website, I want to know how to make Laravel go back to the profile page after the follow or unfollow happened, is there is a way that I can redirect to the profile con…
Insert a Json object in MongoDB from Laravel 7
I need upload a image to Google storage and insert the below JSON object with the gcs image path in MongoDB. The image is successfully getting uploaded in GCS, but I am not able to get the image url of the image and also not able to update the path in mongoDB. JSON object format Can anyone help me to