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
Tag: php
jQuery find element with class name which is added dynamically
I have a navigation which is listed dynamically with PHP. The html : The highlighted the tags are listed dynamically I have a JS script, when we click on the navbar element then we add .selected class to the tag. When the page is loaded the first tag has .selected class. I need a JS code to find the data-prop
Increasing the conditions in IF statement with loop PHP, Diagonal Check
I have homework to do this program in PHP, that take a matrix and the keywords, so it can find them in the matrix diagonally: So this is how the first matrix looks, there are many with different keywords, here for instance keywords are “beef” and “pork”. So I made a program for an inpu…
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…
How to compare conetent with two tags using Xpath
I have below scenarios of $html contents. I want to check if html content is start with a media (image or video, iframe) without any text content like 3rd scenario. //no contetn between first p tag and image tag //no content between first p tag and video tag //having content inside first p tag I have tried li…
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 …
How to loop so I can separate 2 values? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year. Improve this question I’m trying to make an inventory system as part for my e-commerce project so I need to ge…