Search code examples
phplaravel-5.3

How to determine the incoming request nature in laravel


Lets say I have incoming url

/writer/$category

It's Route it written as

Route::get('/writer/{category}', ['uses' => 'WriterController@index']);

Now how to determine in Controller that whether the category is string or integer.


Solution

  • You can get the type with gettype function, like this:

    dd(gettype($value));
    

    at your controller