Skip to content

Tag: laravel

Laravel. Tests clear the active DB

The tables in my active DB are empty after tests. I have the test environment variable DB_CONNECTION=mysql_testing. When I run my tests and do dd(env(‘DB_CONNECTION’)) – everything is fine. I see ‘mysql_testing’. But when I write dd( DB::connection()->getDatabaseName()) I see …

json rpc 2.0 in laravel api errors on add request

I add https://github.com/sajya/server for making json rpc over my laravel 8. I just follow the instructions provided here to test it https://sajya.github.io/docs/ All works for the basic example, But if I add params to the curl string an error is raised an error that i cannot understand: my code: my route api…

PHP looping over data and getting key/value pairs

I’m using Laravel 8 to loop over some data. I’ve got my data out from my database, but am struggling to loop over the data in a foreach loop, it doesn’t appear to be giving me the key/value pairs, only the index/value pair? But if I var_dump() my $applicationOptions I can see the array insid…

get a deeper element which satisfies the condition

Need to get the postal_code value, which is the value of long_name with types=postal_code. In the api result,it seems types itself is an array. Looping and finding out is a bad method. also array_search also don’t work. Can anybody help me. Answer Just loop through the array and find an item with the po…

Submit Laravel form using JavaScript

I have an HTML form that I currently submit using the form action attribute and a php script. The post request is successful, but it reloads the page, and I want to avoid that. The project uses Laravel/Blade PHP templates. To prevent page from reloading, I would like to send the post request using JavaScript …

Problem with displaying pictures in laravel 7

i’m working on Laravel 7 , i want to display the images added by the administrator, but they don’t show up. This is the index.blade.php : This is the adress of the pictures : C:wamp64wwwProjectclientstorageapppublicproductSeptember2020 Thanks fo help Answer First create a symbolic link : Then a sy…