Git Product home page Git Product logo

Comments (21)

mabasic avatar mabasic commented on July 22, 2024

I just tried it with L5.4 and it works as expected. Going to test with L5.2 and let you know

from comments.

mabasic avatar mabasic commented on July 22, 2024

Just tried with L5.2.31 and it works as expected. No errors. Have you followed the readme on Installation?

from comments.

agouticreative avatar agouticreative commented on July 22, 2024

Yes I have. Entirely possible I did something wrong.
Have you ever seen a situation where the POST request turns into a GET request for no reason? that seems to be what is happening. Everything else is working.

from comments.

mabasic avatar mabasic commented on July 22, 2024

When you post a comment two request are made.

  • One is a POST request that sends the data.
  • The other is a GET request that loads the comments.

Are you using this syntax in your view to declare your content_type class?

@include('comments::comments-react', [
    'content_type' => App\Book::class,
    'content_id' => $book->id
])

Try creating a new laravel application, install the package and follow the readme. Then, you can compare what is different in your application. I have tried with L5.2 and 5.4, and it works without a glitch.

I will be making a video tutorial on how to install this package, maybe that will help you.

P.S. Have you entered the models that can be commented upon in the config?

from comments.

agouticreative avatar agouticreative commented on July 22, 2024

If I get the opportunity yes I will do that.
For now I am going to write a vanilla/jQuery adapter for the endpoint. It occured to me that it might be a bit dangerous to deploy a React-based product when I'm not that good at React... Maybe I'll even do a PR if it's something that could be folded in.
The one thing I will say before moving on is that the initial GET to http://www.xxx.com/api/v1/comments?content_type=App%5CModels%5CExpense&content_id=39 works fine. So that seems to imply that my config is correct. It's just the POSTing of the comment that seems screwy. It really looks like it turns into a param-less GET request. It does seem likely that it's a conflict with something on our end; if I trip over it I will let you know. Thanks.

from comments.

agouticreative avatar agouticreative commented on July 22, 2024

Hey I figured it out.
I'm not sure why you aren't seeing it; besides a lack of imagination on my part, or blindness to something about my own env, I have to assume you aren't serving files with apache, or otherwise are overriding the .htaccess file.
Here's what I'm seeing:
the comments-react.js uses /api/v1/comments/ as a base path
Laravel ships with a /public/.htaccess file with a rewrite rule that removes trailing slashes from non-folder paths
so the store and index actions are getting 301'ed to /api/v1/comments (note missing trailing slash)
That's fine for the index call, but it breaks the store call, because when you 301 a POST, it is converted into a GET and the data is lost.
when I remove that trailing slash in comments-react.js, everything works great.

from comments.

mabasic avatar mabasic commented on July 22, 2024

I see. I have created a new release 1.1.1 where I removed the trailing slash and modified the URL string for delete and update. Let me know if it works for you.

It still works for me on Nginx, maybe it will work for you too on Apache.

Remember to publish the latest assets once you upgrade the package:

php artisan vendor:publish --provider="Laravelista\Comments\Providers\CommentsServiceProvider" --tag=public --force

from comments.

agouticreative avatar agouticreative commented on July 22, 2024

great! will try today

from comments.

Ande1232 avatar Ande1232 commented on July 22, 2024

I have the same problem... @agouticreative Did you solve the problem? When I visit the page, I point out that I am not login...

There are no comments yet. Be the first to comment. You must login to post a comment.

from comments.

MohamedELSerag88 avatar MohamedELSerag88 commented on July 22, 2024

if i have comments on the model i see this message (There are no comments yet. Be the first to comment. You must login to post a comment.) even i signed in

from comments.

reikaP avatar reikaP commented on July 22, 2024

even the problem still persist on latest laravel build

from comments.

walidbagh avatar walidbagh commented on July 22, 2024

same problem on laravel 5.5 even on fresh install !
what can we do to help you fix it ?

from comments.

mabasic avatar mabasic commented on July 22, 2024

As soon as I find some time I will fix this issue and all others. I have a solution ready, just need to sit down and code it.

from comments.

walidbagh avatar walidbagh commented on July 22, 2024

Great news, thanks for taking time to fix it 🥇 :) @mabasic

from comments.

G00sfraba avatar G00sfraba commented on July 22, 2024

I have the same issue here, only that I get 404 error.
http://dev.local.com/api/v1/comments?content_type=App%5CProjectWeek&content_id=9
Status Code: 404 Not Found

Laravel 5.5

Did you manage to publish a fix? Or I will have to abound this package. Maybe tell us what is the problem so we can code ourselves a temporary fix.

from comments.

davemg3 avatar davemg3 commented on July 22, 2024

I got the same issue today end June 2018...thanks to the creator for this lib but you should specify on the main page that the library is broken. I spend 3h to fight with this issue before discovering it was a well known issue.
You should avoid new people to install your library and potentially running again in some time lost
Thanks

from comments.

mabasic avatar mabasic commented on July 22, 2024

I tell you what... I am fixing this this weekend.

from comments.

davemg3 avatar davemg3 commented on July 22, 2024

@mabasic , thank you , my meaning was your library has some potential, maybe you could let other contributors support you to improve it...for now we cant as your native files are not all published, especially react files

from comments.

mabasic avatar mabasic commented on July 22, 2024

Fixed in version 2.0.0

from comments.

davemg3 avatar davemg3 commented on July 22, 2024

Thanks @mabasic ,
Will see if some other users have the same issue but seems v2.0.0 throw

CommentServiceProvider not found 
Script php artisan package:discover handling the post autoload dump event returned with error code 1

during Composer require command launched for update of package.

from comments.

mabasic avatar mabasic commented on July 22, 2024

You need to remove CommentServiceProvider from app.php.

This new version uses package discovery to register the service provider.

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.