Hi so i'm making simple crud API but somehow when i check the route i keep showing Target class [DataController] does not exist
and this is my controller
namespace App\Http\Controllers\DataController;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Data;
class DataController extends Controller
{
public function index()
{
return Data::all();
}
}
and this my route:
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('data','DataController@index');
Route::post('data','DataController@create');
Route::put('/data/{id}','DataController@update');
Route::delete('/data/{id}','DataController@delete');
I'm pretty new learn about API in Laravel and i saw use php artisan config:cache and composer auto-load don't work as well so maybe something wrong in my code or what?