My route file (routes/api.php) :
Route::group(['middleware'=>'cors', 'prefix'=>'v1/'], function(){
Route::resource('users', 'UserController');
Route::resource('products', 'ProductController');
Route::resource('categories', 'CategoryController');
Route::resource('authenticate', 'AuthenticateController', ['only' => ['index']]);
Route::post('authenticate', 'AuthenticateController@authenticate');
Route::get('authenticate/user', 'AuthenticateController@getAuthenticatedUser');
});
My ProductController file():
public function index(){
$request = Request::create('api/v1/products/', 'GET');
$instance = json_decode(Route::dispatch($request)->getContent());
echo "<pre>"; print_r($instance); exit;
return view('pages.users.my_sell', ['products'=>$products]);
}
while i try to print the $instance variable i get the following error :
i need to get all the object from the api and need to pass the objects to my blade.