Reputation: 580
Problem is i want to take records by Auth::user()->department How to solve this problem in Laravel api + Passport.
"message": "Class 'App\Http\Controllers\API\Auth' not found",
Controller/Api/ApiController.php
public function index(){
$banks = Bank::where('bank', Auth::user()->department)->orderby("created_at",'desc')->get();
return $this->sendResponse($banks->toArray(), 'Амжилттай уншигдлаа.');
}
Upvotes: 1
Views: 322
Reputation: 642
That's it, You just need to add Auth Class in your php file.
use \Auth;
Upvotes: 1