Hot answers tagged

2 votes

How to solve Class "ElasticClient\ServiceProvider" not found

I could solve it, deleting the following files: bootstrap/cache/config.php bootstrap/cache/packages.php bootstrap/cache/services.php Now artisan commands are available. (I let this answer, just in ...
  • 1,011
1 vote

Unchecked checkbox sending value as true

You've misdiagnosed the problem. The checkbox will either send On or nothing depending of it is checked or not. For the rest of this question I will assume it is unchecked and sending nothing. $...
  • 899k
1 vote

import SNP to MySQL Database

SNP file is a binary format that is not compatible with MySQL server if you want to avoid converting the SNP file to CSV, you can consider using a different format that is compatible with MySQL, such ...
  • 329
1 vote

Inserting into mysql database string but /n is removed after import

I think you should use pdo or mysqli to get rid of for all kind of injections and your text will be inserted as you want it. You can try this $insert = $db->prepare(”INSERT INTO ...
1 vote

How to I call a class from a variable with curly brackets, if the class has layered keys?

You need to split the string. Then you can loop over it to get each nested element. $props = explode('->', $testvar1); $obj = $input_obj->collection[0]; foreach ($props as $p) { $obj = $obj-&...
  • 722k
1 vote
Accepted

Meilisearch or Eloquent queries?

Yes, you are using it correctly. When you use get(), first it gets ids from Meilisearch database and then call a query to the datable using whereIn. You can take a look, this is code of get method ...
1 vote

Installing php extensions on Dockerfile

Please try the below solution it might help you. Maybe "freetype" required a "GD" library. So we modified the little bit docker file which is below. I am referring to this link : ...
1 vote

MS SQL sub query from all tables does not work

You cannot do dynamic SQL like this. You need to build a dynamic string of code and execute it using sp_executesql. $sql = " DECLARE @sql nvarchar(max) SELECT @sql = STRING_AGG(CAST(' SELECT ...
  • 42.4k
1 vote

Struggling to merge and display two arrays (result of two query) into one

For example after executing the queries, if you get back $array1 and $array2, then you can do the following: $result = []; foreach ($array1 as $i => $value) { $result[$i] = array_merge($value, $...
  • 496
1 vote
Accepted

How to use array as ... type?

You need to add ... in the call to the function as well. That syntax has two complementary meanings, both documented on the same page of the manual. When used in the declaration of the function, as ...
  • 86.3k
1 vote

How to use array as ... type?

You're using ... to take every argument. You should spread your array before passing it to to(): $myList = [ "address-1", "address-2" ]; $obj->to(...$myList);
  • 496
1 vote
Accepted

How to detect an invalid XML image blob with PHP?

You can use getimagesize() function in PHP to check if the URL is a valid image. This function returns an array with the image information, or false if the file is not an image. You can use @ to ...

Only top scored, non community-wiki answers of a minimum length are eligible