2017 © Pedro Peláez
 

library polycomments

Universal comments for Laravel 5+

image

ptrml/polycomments

Universal comments for Laravel 5+

  • Thursday, September 15, 2016
  • by pepo123
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Polycomments

Simple hookable commenting system leveraging polymorphic relationships. Early super rudimentary pre-alfa. May change drastically at any time., (*1)

Installation

Step 1: Backend

Install via composer:

composer require ptrml/polycomments "dev-master"

Register the service provider in conf/app.php:

'providers' => [
...
Ptrml\Polycomments\PolycommentsServiceProvider::class,
...
],

Publish stuff and migrate:

php artisan vendor:publish --tag=polycomments
php artisan migrate

Implement both the interface and trait on your models:

class Post extends Model implements CommentableInterface
{
    use Commentable;
    ...
}

(Switch the Post model with your own)
, (*2)

Step 2: Frontend

Append PolycommentsController.php with your calls (Post is an example model):

class PolycommentsController extends Controller
{
    function commentPost(Request $request,$id)
    {
        Commenter::comment(Post::find($id),$request);
        return redirect("home");
    }
    ...
}

(Switch the Post model with your own), (*3)

Append routes:

Route::post('/polycomments/post/{id}', 'PolycommentsController@commentPost')->name('polycomments.post');

Add the premade comments block to the views of your model:

@include('polycomments::polycomments',['polycomments_subject'=>$post,'polycomments_route'=>'polycomments.post'])

(polycomments_subject is your models instance, polycomments_route is the named route)
, (*4)

Step 3: Customization

Edit views/vendor/polycomments/* for a custom look and feel:


, (*5)

Enjoy





, (*6)

License

MIT license., (*7)

The Versions

15/09 2016

dev-master

9999999-dev

Universal comments for Laravel 5+

  Sources   Download

MIT

The Requires

 

by Petar Milevski