Skip to content
Advertisement

Tag: laravel

Middleware auth keep logging me out? Edit: RedirectIfAuthenticated logging me out?

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, but it keeps logging me out when I’m going to HomeController where it had

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 this was behaviour of PHP generally but

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 model Category model: edit product page view: subcats-select view How can I put “selected” attribute

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 class=”form-check-input” name=”orderCheck[]” type=”checkbox” value=”{{ $order->ord_id

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 each questions member contains options array related to it. Answer You

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

Advertisement