Package Data | |
---|---|
Maintainer Username: | huytbt |
Package Create Date: | 2015-09-30 |
Package Last Update: | 2015-10-29 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:07:16 |
Package Statistics | |
---|---|
Total Downloads: | 1,907 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 9 |
Total Forks: | 2 |
Total Open Issues: | 1 |
This is RESTful APIs
Install via composer - edit your composer.json
to require the package.
"require": {
// ...
"php-soft/laravel-comments": "dev-master",
}
Then run composer update
in your terminal to pull it in.
Once this has finished, you will need to add the service provider to the providers
array in your app.php
config as follows:
'providers' => [
// ...
PhpSoft\ArrayView\Providers\ArrayViewServiceProvider::class,
PhpSoft\Comments\Providers\CommentServiceProvider::class,
]
Now generate the migration:
$ php artisan ps-comments:migrate
It will generate the migration files. You may now run it with the artisan migrate command:
$ php artisan migrate
You will want to publish the config using the following command:
$ php artisan vendor:publish --provider="PhpSoft\Comments\Providers\CommentServiceProvider"
Add routes in app/Http/routes.php
Route::group(['middleware'=>'auth'], function() {
Route::get('/comments/{url}', '\PhpSoft\Comments\Controllers\CommentController@index')->where('url', '.*');
Route::post('/comments/{url}', '\PhpSoft\Comments\Controllers\CommentController@store')->where('url', '.*');
Route::patch('/comments/{id}', '\PhpSoft\Comments\Controllers\CommentController@update');
Route::delete('/comments/{id}', '\PhpSoft\Comments\Controllers\CommentController@destroy');
});
You can remove middlewares if your application don't require check authenticate and permission!
Sometimes you need to get users' information while viewing other comments. You can easily use it by:
$user = $comment->users();