Not sure if I'm doing something wrong, but if I try to use a Route::resource(), the __constructor() method is called lots of times.
Code:
Route::api(['version' => 'v1', 'prefix' => 'api'], function()
{
Route::resource('user', 'App\Modules\User\Controllers\UserController');
});
use Dingo\Api\Dispatcher;
use Dingo\Api\Auth\Shield;
use Dingo\Api\Routing\Controller;
class UserController extends Controller {
public function __construct(Dispatcher $api, Shield $auth)
{
$this->api = $api;
$this->auth = $auth;
echo 'test';
}
//...
}
In this case 'test' is called exactly 9 times. Is it ok to use resource controllers?
Not sure if I'm doing something wrong, but if I try to use a
Route::resource(), the__constructor()method is called lots of times.Code:
In this case 'test' is called exactly 9 times. Is it ok to use resource controllers?