php-soft / laravel-comments
The Laravel Framework.
Installs: 1 907
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 9
Forks: 2
Open Issues: 1
Type:project
Requires
- php: >=5.5.9
- doctrine/dbal: ^2.5
- laravel/framework: 5.1.*
- php-soft/laravel-array-view: 1.1.x
Requires (Dev)
- fzaninotto/faker: ~1.4
- mockery/mockery: 0.9.*
- phpmd/phpmd: 2.2.*
- phpspec/phpspec: ~2.1
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: 1.4.*@stable
This package is auto-updated.
Last update: 2024-12-21 20:41:25 UTC
README
This is RESTful APIs
1. Installation
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, ]
2. Migration and Seeding
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"
3. Usage
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!
3. Get comment's user
Sometimes you need to get users' information while viewing other comments. You can easily use it by:
$user = $comment->users();