Comments (10)
Hi @jimcouts ,
What I did in my project (whit similar configuration than yours) is to extend the controller of this package and overwrite the constructor like:
<?php
namespace XXXXXXXXX\Member\Http\Controllers;
use Laravelista\Comments\CommentController;
class Comments extends CommentController
{
public function __construct()
{
$this->middleware('member');
if (config('comments.guest_commenting') == true) {
$this->middleware('auth:member')->except('store');
} else {
$this->middleware('auth:member');
}
}
}
Note how I'm passing the guard member to the auth middleware. Now, I'm not a Laravel expert so I'm no sure this is the right way to accomplish this, or even if there is a different way to do it.
Let me know if this was of help to you.
from comments.
@jimcouts I think that this could be fixed in the latest version. Maybe give it a try. It was missing the web
middleware. Maybe that was the issue.
from comments.
Maybe @eworwa will know something about this. I think that he has been working with the guards and middleware in his project.
I will check the config and the controller for why it is not working.
from comments.
Thanks @mabasic it's been puzzling me since last night.
from comments.
Many thanks, I'll give this a whirl, and glad to see I wasn't the only one that's crazy with this guard system :) I'll report back and let you know how it goes on my end so that the member can create comments as well!
Now, I'm not a Laravel expert so I'm no sure this is the right way to accomplish this, or even if there is a different way to do it.
Me neither, I'm more of 15+ years with procedural py
myself, but I'm having a blast learning the laravel framework! (Which to me is daunting at times but very rewarding on the end.)
from comments.
@eworwa - Yeah, it's a no go still, I'm at a loss until I get some time to figure this out later this week coming up. I appreciate the input here.
from comments.
@jimcouts Have you managed to solve this issue?
from comments.
@jimcouts Have you managed to solve this issue?
No, we put this on hold while we're building out another part of the system. Were you able to replicate this? If not, I'll setup a remote via AnyDesk to see what we're talking about.
from comments.
It's still showing this, since I just redid the config file with:
/**
* The Comment Controller.
* Change this to your own implementation of the CommentController.
* You can use the \Laravelista\Comments\CommentControllerInterface.
*/
'\Laravelista\Comments\CommentController',
/*'controller' => '\XXXXX\Member\Http\Controllers\Comments',*/
Which still shows the following:
Authentication Required to Post a Comment!
You must be logged in to post a comment!Or register to become a member today!
I think if you would like, I can send you an invite to my desktop on a day that works out for us both so you can see what I'm doing here. Also, I will be a patron here soon enough, really love the start of this project and how easy it is to implement into ours, but I know it'll work for others without a problem. :)
I'm off the rest of this weekend, shoot me a way to contact you? If it's in the code with your email in a note somewhere in there I'll shoot you an email.
from comments.
In your config file you should set your custom controller like this:
/**
* The Comment Controller.
* Change this to your own implementation of the CommentController.
* You can use the \Laravelista\Comments\CommentControllerInterface.
*/
'controller' => '\XXXXX\Member\Http\Controllers\Comments',
Also be sure to follow the code from eworwa in this comment
Important! Don't forget to include the web
middleware. Without it it won't work. See the latest version of the Laravelista\Comments\CommentController
. Don't forget to update to the latest version of the package.
P.S. Thank you for considering to sponsor me on Patreon.
from comments.
Related Issues (20)
- Argument Two passed HOT 9
- Call count on Null HOT 3
- On server not Working.. HOT 2
- Changes not detected in Blade File HOT 4
- Error installing for Laravel 7 HOT 1
- Latest Release Tag? HOT 1
- Argument 2 passed to Laravelista\Comments\CommentPolicy::reply() must be an instance of Laravelista\Comments\Comment HOT 1
- The edit/replay button not working
- Laravel 9.x Compatibility HOT 1
- ajax support HOT 1
- Reply for Guest Users HOT 1
- Spatie permission issues after upgrading to Laravel 9 HOT 2
- unable to install in laravel 9 HOT 7
- Loading all comments? HOT 1
- Attempt to read property "comments" on string
- Section added after the comment block is not working -
- markdown styling is not working
- Laravel 9 doesn't support HOT 1
- Abandoned HOT 1
- Not compatible with Laravel 10.X , unable to install HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comments.