Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(example): add command to publish example assets #406

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/MessagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Http\Controllers;

use App\User;
use App\Models\User;
use Carbon\Carbon;
use Cmgmyr\Messenger\Models\Message;
use Cmgmyr\Messenger\Models\Participant;
Expand Down
11 changes: 6 additions & 5 deletions examples/routes.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
use App\Http\Controllers\MessagesController;

Route::group(['prefix' => 'messages'], function () {
Route::get('/', ['as' => 'messages', 'uses' => 'MessagesController@index']);
Route::get('create', ['as' => 'messages.create', 'uses' => 'MessagesController@create']);
Route::post('/', ['as' => 'messages.store', 'uses' => 'MessagesController@store']);
Route::get('{id}', ['as' => 'messages.show', 'uses' => 'MessagesController@show']);
Route::put('{id}', ['as' => 'messages.update', 'uses' => 'MessagesController@update']);
Route::get('/', [MessagesController::class, 'index'])->name('messages');
Route::get('/create', [MessagesController::class, 'create'])->name('messages.create');
Route::post('/', [MessagesController::class, 'store'])->name('messages.store');
Route::get('/{id}', [MessagesController::class, 'show'])->name('messages.show');
Route::put('/{id}', [MessagesController::class, 'update'])->name('messages.update');
});
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ class User extends Authenticatable {
```

## Examples
publish example using following command. This will publish controller and views. you can copy route and put in your routes file.

```
php artisan vendor:publish --provider="Cmgmyr\Messenger\MessengerServiceProvider" --tag="messenger-assets"
```

* [Controller](https://github.com/cmgmyr/laravel-messenger/tree/master/examples/MessagesController.php)
* [Routes](https://github.com/cmgmyr/laravel-messenger/tree/master/examples/routes.php)
* [Views](https://github.com/cmgmyr/laravel-messenger/tree/master/examples/views)
Expand Down
12 changes: 12 additions & 0 deletions src/MessengerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ protected function offerPublishing()
$this->publishes([
__DIR__ . '/../migrations' => base_path('database/migrations'),
], 'migrations');

$this->publishes([
__DIR__ . '/../examples/views/messenger' => resource_path('views/messenger'),
], 'messenger-assets');

$this->publishes([
__DIR__ . '/../examples/views/layouts/master.blade.php' => resource_path('views/layouts/master.blade.php'),
], 'messenger-assets');

$this->publishes([
__DIR__ . '/../examples/MessagesController.php' => app_path('Http/Controllers/MessagesController.php'),
], 'messenger-assets');
}
}

Expand Down