Support the ongoing development of Laravel.io →
posted 8 years ago
Requests

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.php

Route::group(['prefix' => 'api', 'middleware' => 'auth:api'], function() {
	Route::resource('test', 'TestController');
});

TestController.php

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.php

Route::get('/test', 'ApiController@index');

ApiController.php

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

Last updated 3 years ago.
0

Have you checked the error log?

storage/logs/laravel.log

0

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 ???

0

Sign in to participate in this thread!

Eventy

Your banner here too?

trawell trawell Joined 28 Nov 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.