foo.blade.php FooController.php the national-id field should contain 10 digits and I actually expected the code above to validate this , but instead It will check If the national-id exactly equals to 10 or not … how can I validate the length of a numeric field? Answer In fact you don’t need to use digits_between rule. You can use digits rule
Open a password protected EXCEL in wamp using PHP
I have an excel that has a password (When you open it, it asks for a password). I want to open it and save it to a new folder. Supposing that there is no password my script would be : How can I mention the password of the file in the fopen function? It must be only one line that
Reading from weight scale problems (PHP)
I’m new in php. For now I can read the code (not good), and can write a little bit. I have several weight scales. From first one I can read the weight with this script: // host and port to …
yaml xampp warning: Unable to load dynamic library ‘C:xamppphpextphp_yaml.dll’
I installed the recent versions of xampp for windows and yaml on my PC with windows 8.1 64bit. The versions were xampp-win32-7.0.9-1-VC14-installer.exe php_yaml-2.0.0rc8-7.0-ts-vc14-x86.zip I put the line of extension=php_yaml.dll to the end of php.ini file. I copied php_yaml.dll to C:/xampp/php/ext folder. I copied yaml.dll to C:/xampp/apache/bin folder. phpinfo(); command displayed that yaml was enabled. But bad warning still appeared on
Blade Foreach alternating classes
I am using a blade template and I was wanting to know within my foreach what the best way is for me to have it so that my first .panel-heading has another class added to it and then the second one has …
Executing nodejs script file in PHP using exec()
In my Application, I want to execute a Node.JS file from PHP which in turn makes a http request to another PHP file. In short this is the Process that I am doing. PHP file—>calls–> Nodejs file—>…
Sum column values from multiple arrays
I have an arrays with dynamic name. My array could be more than 3, depends and array variable should be unique I need to get an output like this: Answer Why aren’t you using a multidimensional array? In this case you will have an array of arrays: You can go with nested for loops: The output is Now, if you
Alternative header in php
Is there’s an alternative way to the header in PHP to redirect the page? Because I can’t write any statement before the header. Snippet:- Answer There are different ways to do so. – You can set delay in your code so that that much amount of time the page stops on that page and after that it will execute next
Laravel – Eloquent – Dynamically defined relationship
Is it possible to set a model’s relationship dynamically? For example, I have model Page, and I want to add relationship banners() to it without actually changing its file? So does something like this exist: Or something similar? As they are fetched using the magic methods anyway, perhaps I can add the relationship dynamically? Thanks! Answer I’ve added a package
Laravel use Request validation with api
I’m trying to implement validation in my api like this: RideUpdateRequest: So how could I give a error message back in json (if the request validation fails)? Right now in postman I receive nothing back? –EDIT– response: Could I get something like this?: Answer If you take a look at the FormRequest class, you’ll see a response() method defined as