Skip to content

Laravel: showing selected value in edit form

I added a drop down list in the user registration form in Laravel. Now I want to make a form to edit it but I’m stuck. What I did is I made a drop down list which a new user can register where he/she …

Reload database before some test in phpunit

I’m currently developing unit tests with phpunit, and symfony 5. On a previous job using behat, we were able to reload the database only for the tests having a specific tag. I’d like to do something similar. I know there is the setUp() method and the @before annotation, but they don’t let me…

Laravel store multiple just saves one

I am sending array of data to controller but it only saves 1 row to database, I need to save multiple rows (depend on array length). Code controller Screenshot request data stored data any idea? Answer Move $transit = new Transit; inside the foreach, and end the foreach loop right before returning the respons…

PHP, Image preview with javascript and uploader by PHP

I made PHP script to preview an image before upload it, which is simple and easy to read. the first part is to displays the image then to upload it after pressing Submit button. I have an issue with uploading the image, it doesn’t upload. Answer You have several logical errors in your PHP Code as well a…

PHP Array format with numbers

i have a big trouble with this code, i need format an array to use in different select, i have an array structure same of this: array (size=6) 0 => array (size=9) 0 => string ‘…