Git Product home page Git Product logo

Comments (10)

eworwa avatar eworwa commented on July 22, 2024 1

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.

mabasic avatar mabasic commented on July 22, 2024 1

@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.

mabasic avatar mabasic commented on July 22, 2024

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.

jimcouts avatar jimcouts commented on July 22, 2024

Thanks @mabasic it's been puzzling me since last night.

from comments.

jimcouts avatar jimcouts commented on July 22, 2024

@eworwa

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.

jimcouts avatar jimcouts commented on July 22, 2024

@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.

mabasic avatar mabasic commented on July 22, 2024

@jimcouts Have you managed to solve this issue?

from comments.

jimcouts avatar jimcouts commented on July 22, 2024

@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.

jimcouts avatar jimcouts commented on July 22, 2024

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.

mabasic avatar mabasic commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.