-2

i created a login system with Laravel & sentinel. after that i just test api in Laravel with this code to obtain some data about the current logged in user using this code in api.php. but i had an error message when i test it " The use statement with non-compound name 'Sentinel' has no effect"

  <?php

 use Illuminate\Http\Request;
 use Sentinel;



    Route::get('/test', function(){
       if(Sentinel::check()) {
          return response()->json([
              'loggedUser' => [
                'firstname' => Sentinel::getUser()->first_name,
                'lastname' => Sentinel::getUser()->last_name
              ]
        ]);   }else {
          return null;
        }
  }
);
Ahmed Masry
  • 17
  • 1
  • 6

1 Answers1

1

The routes file is not namespaced. The use Sentinel statement is not needed, and is what is causing your error.

Delete your use Sentinel statement.

patricus
  • 59,488
  • 15
  • 143
  • 145