I'm currently working on api jwt based authentication off a boiler plate on SitePoint. So far I've gotten everything working but I'm stuck on this point.
My Controller looks like this:
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use Dingo\Api\Routing\Helpers;
use Symfony\Component\HttpKernel\Exception\HttpException;
use JWTAuth;
use App\Http\Controllers\Controller;
use App\Order;
// use App\Api\V1\Requests\LoginRequest;
use Tymon\JWTAuth\Exceptions\JWTException;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
in the body I have this function:
public function checkThis()
{
$currentUser = JWTAuth::parseToken()->authenticate();
$orders = App\Order::first();
echo $orders;
function() {
echo "stll here";
};
}
Under my api route I have this in a middleware:
$api->get('orderlist', 'App\\Api\\V1\\Controllers\\OrderController@checkThis');
When I run this in postman I get the following error: "message": "Class 'App\Api\V1\Controllers\App\Order' not found",
I've tried everything I can think of and it still keeps happening. When I take it out of the controller and run it directly in the routes it works. I'm a newbie to Laravel and PHP so I'm kinda of stuck.