Git Product home page Git Product logo

comments's People

Contributors

abdallamohammed avatar bosunski avatar fabianfetting avatar fey avatar grassisupport avatar imnotjames avatar jipem avatar joelwmale avatar laravel-shift avatar maartenderie avatar mabasic avatar macagoraga avatar mattrabe avatar papoms avatar riaan-za avatar rocramer avatar shanecp avatar whakru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

comments's Issues

Strange Error After first comment (Uncaught Error: Illegal argument undefined)

Everything worked fine until the first comment. console produced an error with following trace
""""""""""""""""""""""""""""""""""
Uncaught Error: Illegal argument undefined
at e.exports (comments-react.js:12)
at t.value (comments-react.js:11)
at comments-react.js:13
at s (comments-react.js:12)
at _renderValidatedComponentWithoutOwnerOrContext (comments-react.js:13)
at _renderValidatedComponent (comments-react.js:13)
at _.performInitialMount (comments-react.js:12)
at _.mountComponent (comments-react.js:12)
at Object.mountComponent (comments-react.js:3)
at Object.updateChildren (comments-react.js:12)
""""""""""""""""""""""""""""""""""

Change Image

The default image is showing with the comment.
I have image path of user profile in column name avatar in user table.
How can i set the image from that column

Registered user can't write comments if guest comments are enabled

Hello,

thanks for the great package. If I enable guest commenting, the user cannot write comments anymore. The problem is that the controller is applying the guest commenting validation rules if the guest commenting is enabled and not, if the user is actually a guest.

If I change if (config('comments.guest_commenting') == true) { into if (! Auth::check()) { in the following code, it is working fine.

       // Define guest rules if guest commenting is enabled.
        if (config('comments.guest_commenting') == true) {
            $guest_rules = [
                'guest_name' => 'required|string|max:255',
                'guest_email' => 'required|string|email|max:255',
            ];
        }

Is it possible to change the ID to a class, so we can use multiple comment boxes on 1 page?

I have a timeline, where a user can comment on multiple statuses, but at the moment, this uses an ID, so will only render to 1, is it possible to change to a class so it renders to all on the page? I tried changing some of the code, but kept getting:

Target container is not a DOM element

I changed:

<div id="laravelista-comments"></div>

to

<div class="laravelista-comments"></div>

and in the app.js to:

import React from 'react';
import ReactDOM from 'react-dom';
import CommentBox from './components/CommentBox.jsx';

window.Laravelista = window.Laravelista || {content_type: null, content_id: null, login_path: '/login'};

var elementLength = document.getElementsByClassName("laravelista-comments").length;
if (elementLength > 0) {
    for (var i = 0; i < elementLength; i++) {
        ReactDOM.render(
            <CommentBox content_type={Laravelista.content_type} content_id={Laravelista.content_id} login_path={Laravelista.login_path} />,
            document.getElementsByClassName('laravelista-comments')[i] //mountNode
        );
    }
}

Is there anyway to achieve this?

422 error when trying to comment?

Hi. I wanted to give your package a shot and implementation went smoothly until I tried to post a comment for the first time.
It appears that three api calls happen, two of which are the same:

one is a GET of /api/v1/comments, returns a 422. this is the response: {"error":{"message":{"content_type":["The content type field is required."],"content_id":["The content id field is required."]},"status_code":422}} It doesn't seem to send the contents of window.Laravelista, which I have to imagine is what it wants to do.

Then a second one happens that seems marginally more successful. It is a GET of http://www.airhub.dev/api/v1/comments?content_type=App%5CModels%5CExpense&content_id=19, which returns something like this: {"data":[],"meta":{"user":{"data":{"id":2,"name":"User Name","email":"[email protected]"}}}}

But the content I type in never seems to be posted.

I'm trying it out with Chrome 57, Laravel 5.2, and PHP 7.

If I had a non-minified copy of the React I would spend more time trying to suss out the issue, although my React skills are limited; since only the minified versions are in the repo, I'm just going to go ahead and ask for help.

Thanks!

The installation is working

I follow all the step but it not working.

  1. publishing thing not work.
  2. I included use Laravelista\Comments\Commenter;
    getting this error
    Trait 'Laravelista\Comments\Commentable' not found

3)for this also Laravelista\Comments\Commenter same error

App Engine: Please provide a valid cache path.

I had the issue 'Please provide a valid cache path." when deploy.

I found a lot solution from web, and I had did below solution, but the error still occur

  1. clear cache
    php artisan route:clear
    php artisan view:clear
    php artisan config:clear
    php artisan cache:clear

  2. confirm file exist
    storage/framework/cache
    storage/framework/sessions
    storage/framework/views

  3. add code to bootstrap/app.php
    $app->useStoragePath(env('APP_STORAGE', base_path() . '/storage'));

  4. declare APP_STORAGE app.yaml
    APP_STORAGE: /tmp
    VIEW_COMPILED_PATH: /tmp
    SESSION_DRIVER: cookie

Comment view

How to Have a View i copy it but nothing happend

Can't comment even though user is logged in.

I reproduced all the steps provided in the installation, included the comments in my designated Model, being simple news articles, but I can't seem to comment anything even though a user is logged in, when I press on the login link (as a logged in user) in "You must login to post a comment." It redirects me to a /home route that doesn't exist in my project, otherwise, if a user isn't logged in, the link redirects me to my login page.
Any help would be appreciated!

Does not display comments

I have just downloaded laravelista/comments.

I followed the instructions exactly, I think, when I open localhost:8000/post/show/1(because that is my specified view),it shows the details of the post and the comment text area.When I type into the comment textarea, and press submit,it reloads the page and does NOTHING.It doesn't insert the data into the comment table nor does it show the just typed comment nor does it even show any error.So at this point,I don't have a clue what is going wrong.

I know I am supposed to post some of my code,but I don't know which code to post,whether it is the routes,the blades files,the migrations,the db schema,the laravelista/comments source etc and I can't just go ahead and post everything or post some code that you won't even need.

So please,any code that you may like to view to help me out just kindly let me know and I will be happy to show you.

Thanks in advanced

Where are the docs?

I see some "how to install" on the main page, but is there no documentation beyond that? I am trying to make a rest api, so i need routes to create and such. Also, when I install, I don't have a migration file for comments. Any ideas as to what's going on?

Override defined permission

How can I override defined permission like edit-comment, delete-comment, etc.
I try to add them in my AuthServiceProvider, but it not work.

New functionality: comment edited

Hey,

I wanna show the user if a comment was changed. I'd add a column 'edited' (datetime) and show the status ('last changed') in the views. Are you okay with a PR?

Implement comment approval functionality

Because I plan to enable guest commenting I think that there should be a system in place to control "review" comments before displaying them on website.

I used this package (a modified version) for handling product reviews and there you don't really want to display the reviews right away before checking them.

The UI for doing this should be up to the developer "you" to implement in your website, but the feature will be available in this package by setting the approval_required configuration option to true.

This option will make use of the approved boolean column in the database for comments.

Then you could fetch only approved comments by using a scope approved() in your controller or something like that.

/comments redirect to /login

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 !

This package causes App Engine deployments to fail.

Hello,

This package is awesome. I set it up in a few minutes, adjusted it to my liking and then tried to deploy a test version to my appengine production project.

As far as I can tell its happening during the composer scripts. As an example:

Step #1 - "builder": In Compiler.php line 36:
Step #1 - "builder": 
Step #1 - "builder": Please provide a valid cache path. 

... then ...

Step #1 - "builder": Generating optimized autoload files
Step #1 - "builder": > Illuminate\Foundation\ComposerScripts::postAutoloadDump
Step #1 - "builder": > @php artisan package:discover --ansi
Step #1 - "builder": Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Step #1 - "builder": 
Step #1 - "builder": error: `composer_install` returned code: 1
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder": "__main__", fname, loader, pkg_name)
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder": exec code in run_globals
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 57, in main
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 58, in UserErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/php72_app_builder:php72_20190515_7_2_17_RC00" failed: exit status 1

Just wanted to know if you had any idea what could be causing this? I am using Laravel 5.7, php72 and if I composer remove your package, the deployment scripts run fine. My suspicion is that it is trying to cache or discover something in your package (or the included markdown parser) and failing.

Keep in mind, I realize your package probably works on 99% of deployments... and appengine is a weird case. So I'm just looking for advice if you have time. The issue seems to happen at the same step as this previously closed ticket: #16

Thanks!

DB migration issue

Hi,
thanks for the package.

I believe I found an issue with the migration. The child_id foreign key has a different column type from the id column. So, when you run php artisan migrate, an error occurs:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint

More info:
foreign key (child_id) references comments (id) on delete cascade: Cannot find an index in the referenced table where the referenced columns appear as the first columns, or column types in the table and the referenced table do not match for constraint. Note that the internal storage type of ENUM and SET changed in tables created with >= InnoDB-4.1.12, and such columns in old tables cannot be referenced by such columns in new tables. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-foreign-key-constraints.html for correct foreign key definition.

Changing the column type of the child_id column from BIGINT to INT fixes the issue:
$table->unsignedInteger('child_id')->nullable();

Impossible to install via composer

Hello,

seems to be a great package. Unfortunatelly when I try to install it it shows me this:

  - Installing laravelista/comments (2.0.1): Loading from cache
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover

In Facade.php line 221:
  Call to undefined method Illuminate\View\Compilers\BladeCompiler::component() 
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

Any idea how to fix this ? I'm using Laravel 5.5.40

Flag comment function

Is there an option for me to add a "flag comment" function to this component, or are there plans to add this functionality?

Use blade for displaying purposes instead of react

While the software was extremely easy to install and start using, it has several downfalls that I believe can be fixed by using blade for displaying.

For example, users may have different timezone settings and as it's currently not possible to apply those settings when displaying the times. Another thing that I would like to do is remove the icon that is displayed next to the posts but again.

Translate

Hello. I'm brazilian and need to translate the component to portuguese-br. Is that possible? Thanks.

Rating

Are you planning to keep rating feature as well ?

Using the Guard System

We're using the Laravel Guards system. Has anyone gotten this to work with this yet? We can't seem to get this one to work with this type of setup for commenters:

  'guards' => [
       'web' => [
           'driver' => 'session',
           'provider' => 'users',
       ],

       'api' => [
           'driver' => 'token',
           'provider' => 'users',
       ],

       'member' => [
           'driver' => 'session',
           'provider' => 'member',
       ],
   ],

I've tried to use the following as well:

'controller' => '\XXXXXXXX\Member\Http\Controllers\Comments',

Which is:

<?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')->except('store');
        } else {
            $this->middleware('auth');
        }
    }
}

It seems it's not seeing my change to the config pointing at the new controller after a dump-autoload as well. So, my question, does this package support the guard system and us defining 'provider' => 'member', ?

Because I'm not seeing it pick up the logged in member's session at all, where the member can view their dashboard and etc, but on this blog post, we're trying to get this to work there, and it still shows the login button and it's not seeing they're logged in...

Help needed

How can i use laravelista/comments in order to show latest posted comments on top rather than first comment posted.

Timezones?

I'm in PST but seeing the datetime for each comment in UTC.
Any suggestions on having the UX show the correct timezone?

Invalid argument supplied for foreach()

Trying to install the package i get :

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   ErrorException  : Invalid argument supplied for foreach()

  at C:\laragon\www\test\vendor\laravelista\comments\src\ServiceProvider.php:37
    33|      * Define permission defined in the config.
    34|      */
    35|     protected function definePermissions()
    36|     {
  > 37|         foreach(config('comments.permissions') as $permission => $policy) {
    38|             Gate::define($permission, $policy);
    39|         }
    40|     }
    41|

  Exception trace:

  1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Invalid argument supplied for foreach()", "C:\laragon\www\test\vendor\laravelista\comments\src\ServiceProvider.php", [])
      C:\laragon\www\test\vendor\laravelista\comments\src\ServiceProvider.php:37

  2   Laravelista\Comments\ServiceProvider::definePermissions()
      C:\laragon\www\test\vendor\laravelista\comments\src\ServiceProvider.php:52

  Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

I'm using the latest Laravel. which is 6.5.1 updated from 6.4.1
Any idea whats wrong here?

Delete on boot

Hi. It would be nice to have a boot method that listens to the delete event and remove any associated comments of the model.

Performance with nested comments

With only 38 comments with multiple nested comments page started loading in 1+ second.
The problem is in

@if(array_key_exists($comment->id, $grouped_comments->toArray()))

with repeated collection to array convertion.

Replacing
@if(array_key_exists($comment->id, $grouped_comments->toArray()))
with
@if($grouped_comments->has($comment->id))

fixes the issue. my page load time dropped to 200ms.

Call to undefined method

Call to undefined method xxxx\Presenters\PostsPresenter::findOrFail()

this happens when I tried to post.

After some analysis i dropped the (mccool) pagepresenter, because this causes it. I just uses the presenter for the date, which can easily be finetuned from blade itselves.

Although, if somebody knows how I can combine this package with a presenter (which has no findorfail method inside), I will be glad to hear.

How to change this config param in config/comment.php

I tried to change some param in comments.php like guest_commenting=true, and then I run:
php artisan vendor:publish --provider="Laravelista\Comments\ServiceProvider" --tag=config.
After that in the view page I print the guest_commenting by
{{dd(config('comments.approval_required'))}} but I was show false. How can I fix that? Thank you very much for your help.

like on comments and replies

Hello Laravelista,

I really appreciate your efforts for this package, i was just thinking if you can add the like feature on comments and replies. then this package would be more flexible and usable.

Improve SEO for comments

TODO:

  • Display comments using a blade partial and only use React.js to create a new comment
  • Make use of broadcasting events to display and update comments?
  • Enable linking to specific comments instead of only #comments

Guest commenting

I would like users to be able to leave a comment as a guest (without logging in) on my project. Is there any support or roadmap for this? If not, would you be open to a PR? I would think requiring a recaptcha a for guest comments would be sensible.

Unable to post comments Laravel 5.6

When I log in and try to connect the page just reloads but the comment is not posted to the database.
I'm using wamp for my development in Laravel

Migration Issues

Hello,

First of all, thanks for this package, but right in the start the migration is failing, please see below, and yes, I have max set inside the AppServiceProvider.php as follows:

Schema::defaultStringLength(191);

php artisan migrate

In Connection.php line 664:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter table `comments` add index `comments_commenter_id_commenter_type_index`(`commenter_id`, `commenter_type`))

In PDOStatement.php line 143:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

In PDOStatement.php line 141:

  SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes

Different Documentation

I just installed this package using composer. But when i continue to migrate the database, it showed that nothing to migrate. I'm using steps from this page.
But when i open readme.md in vendor file, it's different. File structure is different too.
Seems like when im running composer require, it downloads ver.1xx

PHP 7.3 support

Hello.

I`m trying to install this package in PHP 7.3

composer install

But i have error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravelista/comments 2.0.1 requires php 7.2.* -> your PHP version (7.3.1) does not satisfy that requirement.
    - laravelista/comments 2.0.1 requires php 7.2.* -> your PHP version (7.3.1) does not satisfy that requirement.
    - Installation request for laravelista/comments 2.0.1 -> satisfiable by laravelista/comments[2.0.1].

How to fix it? thanks...

Please, add support PHP 7.3

Multiple pages or just one?

Hi! Honestly I did not understand one thing, Can it be used on multiple pages or just one?
How do you know which article is that comment?

Localization

Hey !
Well done with this plugin. It's very useful.
I only got one thing to suggest : Add localization feature. I think it would be very appreciated and will make it even better.

Laravelista does not log in

Even when logged in my laravelista comments section still shows "You must login to post a comment". Please help me fix this. Laravel 5.4.0/PHP 5.6.29

orderBy count comment

Hello,

In a query listing commentable articles, is it possible to make an orberBy number of comments?

Thanks !

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.