Hello Community
sorry for me bad english
So, i have two Laravel 5.2.* Projects on my Xampp Server
Project One has the following route and controller:
Route::group(['prefix' => 'api', 'middleware' => 'auth:api'], function() {
Route::resource('test', 'TestController');
});
public function index()
{
return response()->json(
Product::orderBy('id', 'asc')->get());
}
so, know when i type in Browser the API URL with API Token (http://server1.dev/api/test?api_token=4NymJsHJmcZfyodSB02oWVp3QR5yiRRC63Jr2bkqgVdNuJKPJhvTs3y8Kjzy), i become my data.
[{"id":1,"id_category":1,"productname":"Volvo","description": OND SO ONE
Know i have in Project two following route and controller
Route::get('/test', 'ApiController@index');
public function index()
{
$url ="http://server1.dev/api/test?api_token=4NymJsHJmcZfyodSB02oWVp3QR5yiRRC63Jr2bkqgVdNuJKPJhvTs3y8Kjzy";
$client = new Client();
$response = $client->get($url);
}
Know i become a 500 Error when i testing this.
Can anyone help me ?
Many Thanks Trawell
No, but now i check it and see follow entry:
[2017-03-08 13:16:10] local.ERROR: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'api_token' in 'where clause' in C:\xampp\htdocs\katalog\vendor\laravel\framework\src\Illuminate\Database\Connection.php:333
This is the log from laravel project with the API.
From second project i call with follow url:
$response = $client->get('http://katalog.dev/api/test?api_token=4NymJsHJmcZfyodSB02oWVp3QR5yiRRC63Jr2bkqgVdNuJKPJhvTs3y8Kjzy');
I not send the api token with this ???
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community