laravelista / comments

Native comments for your Laravel application.
MIT License
745 stars 144 forks source link

/comments redirect to /login #64

Closed Jipem closed 5 years ago

Jipem commented 5 years ago

Hello,

I just added laravelista/comments 3.1.0 to my project based on Laravel 6. But after a long moment of research, whatever the action of comment (add, delete, update), the route /comments redirects to /login .

I did not modify the config file (and also tested with "guest_commenting" to true and false). My config Laravel is "basic". The migration has been launched. The "auth" middleware is working properly on the other controller / route.

In my App\Models\User I added:

use Laravelista\Comments\Commenter;
class User extends Authenticatable
{
    use Notifiable, Commenter;
}

In my App\Models\Profile I added:

use Laravelista\Comments\Commentable;
class Profil extends Model
{
    use Commentable;
}

In my Controller I have:

$comment = Profile::find($id);

In my view file.blade.php I added:

@comments ([
     'model' => $ comment
])

An idea ? Thank you in advance !

mabasic commented 5 years ago

I'm going to look into it. Give me a few minutes to setup a L6 project

mabasic commented 5 years ago

There is something funny going on here.

auth()->user() returns null after I log in. That is why we are getting redirected to /login and then back to where ever you were.

Update Got it. I forgot to add web middleware. Going to publish a fix soon.

mabasic commented 5 years ago

Fixed in 3.1.1.

Jipem commented 5 years ago

It works perfectly (with 3.1.1), thank you @mabasic :)