0

I am new on laravel and I have created a basic dashboard with the api endpoints. Everything works fine on Localhost , but when I have hosted it on the server I get an error saying

Class Laravel\Passport\HasAPITokens; not found on User.php

Here s what my user.php looks like

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasAPITokens;

class User extends Authenticatable
{
    use Notifiable, HasApiTokens;

    protected $fillable = [
        'name', 'email', 'password',
    ];


    protected $hidden = [
        'password', 'remember_token',
    ];
}
?>

Also the api endpoint also stopped working saying the Controller class I have created is not found.

I have followed the steps to publish here : https://www.youtube.com/watch?v=6g8G3YQtQt4&t=557s

7
  • did you put your laravel app in some folders under public_html ? Commented Dec 27, 2017 at 10:24
  • no , I put the public folder in public_html and the other files in other folder created under home folder. I changed the index.php in public_html to point that folder Commented Dec 27, 2017 at 10:26
  • So any of your request is reaching to your controller or not? Commented Dec 27, 2017 at 10:27
  • if I remove HasApiTokens from user , the website and pages starts loading. But the API endpoints is not working . the error says controller not found Commented Dec 27, 2017 at 10:28
  • 2
    Are you developing on Windows and uploading to Linux, by any chance? It looks like you're developing on a case-insensitive filesystem and uploading to a case-sensitive one. The answer given below is a bit light on explanation, but it should fix the issue. Commented Dec 27, 2017 at 10:42

1 Answer 1

5

use Laravel\Passport\HasApiTokens;

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks , this worked . @iainn thanks for the explanation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.