I am just studying about laravel as api and I am using Dingo/Api to do it.
I have a controller:
<?php
...
//use Illuminate\Http\Request;
use Dingo\Api\Http\Request;
class RestaurantController extends BaseController
{
public function update(Request $request, $id)
{
//logic to update
}
}
My question is: Should I use Dingo\Api\Http\Request or Illuminate\Http\Request ? I've tested and both of them seems to work the same way. But I keep thinking which one is the most appropriate.
Thanks :D
Most appropriate is using Dingo\Api\Http\Request. Dingo\Api\Http\Request extends Illuminate\Http\Request that's why you were able to use them exchangeably. Reason for using Dingo Request class is to able able for example to get the api version the request is targeting (if not in strict mode), you can also validate Dingo request objects against a domain and api version among other things.