I’m using the function below to show / hide the shipping address section of the checkout based on if a customer chooses local pickup or not. It works fine, however some of the fields in the shipping section are required and so the checkout won’t work if local shipping is selected. Is there a way t…
Tag: php
how to use explode for an array of objects
I have an array like that: I want to do a foreach in “prerequis”: I need in second foreach to use in $value2[‘champ’] where $value2[‘champ’] is “tranche.fus.fup_id. So I need to explode that to have [‘tranche’][‘fus’][‘fup_id’]. How…
How to skip duplicate data in foreach loop
I need help in removing or skipping duplicate data from foreach array, i try to use array_unique() but it doesn’t help. here’s my code. if i have more than 2 products of same category in cart it repeat the same data, which should not. this is what i get from print_r($term_prid) How can i get Answe…
Laravel 8 – Base table or view not found: 1146 Table ‘laravel8.brand’ doesn’t exist
I’ve been searching the web for quite a long time and I have tried adding the protected $table = “brands”; to my Brand Model as seen here: Then on my controller I have the following code: Passing this through my routes: Which I also used on my form inside views/admin/brand folder: My databas…
How to create recursive array from the loop PHP? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year. Improve this question I have an array like below and its dynamic array. I want to create an anothe…
Insert a value at a NOT NULL column int in SQL Laravel Eloquent
I need to have this eloquent inserting data into my table with my first two columns, id, category_id be added with auto increment, specifically, the highest value + 1. my code above has the error: what can I at the “max()” for this to function as intended? any help would be appreciated thanks. Ans…
how to access specific elements from a promise
in php I return to javascript the following: in my js file I have: this writes out to the console: how do I access the value ‘FOUND’ associated with the key ’email’? I’ve tried response[’email’], response.email and response[0][’email’] Answer The title is …
How can I generate a correct CRAM-MD5 response in PHP?
I wish to generate a CRAM-MD5 response for an SMTP server. I can see the theoretical details of how to do so here: CRAM-MD5 Implementation, but I’m looking for the specific PHP code in order to implement it. How can I implement this in PHP? Answer The following PHP code will produce a valid response for…
How can I overwrite my file images in laravel
I would like to ask how can i overwrite/update my images inside the form and store in database? I tried doing it but it is not working, i get the id correct but when i upload new image and text, it is not updating my old file. Below i attached my code. company controller edit modal for company I might
Target class [DatabaseSeedersRoleTableSeeder] does not exist
So I’ve been creating a CMS with Laravel and when I run this command to migrate the tables I’ve been experiencing this error I’ve tried searching to see if someone has the same problem as me, but there seem to be no similar problems. I also can’t tell if the migrations went through or …