@arnoldo.moen
In Laravel, you can get the type of input using the Request object.
Here is an example of how you can get the type of input in your controller or any other class in Laravel:
1 2 3 4 5 6 |
use IlluminateHttpRequest; public function store(Request $request) { // Your code here } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
public function store(Request $request) { $input = $request->input('input_name'); if (is_array($input)) { // Input is an array } elseif (is_numeric($input)) { // Input is a number } elseif (is_string($input)) { // Input is a string } else { // Other data types } } |
By using the is_array()
, is_numeric()
, and is_string()
functions, you can determine the type of input value passed in the request.