From 2fc6fd51b3752543bf17a4dac00db2b43f46c601 Mon Sep 17 00:00:00 2001 From: shailesh Date: Fri, 27 Sep 2024 14:57:32 +0530 Subject: [PATCH] feat(exmaple): add exmple asset publish command --- .idea/.gitignore | 8 ++++++++ .idea/laravel-messenger.iml | 11 +++++++++++ .idea/modules.xml | 8 ++++++++ .idea/php.xml | 20 ++++++++++++++++++++ .idea/phpunit.xml | 10 ++++++++++ .idea/vcs.xml | 6 ++++++ examples/MessagesController.php | 2 +- readme.md | 6 ++++++ src/MessengerServiceProvider.php | 12 ++++++++++++ 9 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/laravel-messenger.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/php.xml create mode 100644 .idea/phpunit.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/laravel-messenger.iml b/.idea/laravel-messenger.iml new file mode 100644 index 0000000..5909e20 --- /dev/null +++ b/.idea/laravel-messenger.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f6da153 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 0000000..ccc3cd3 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/phpunit.xml b/.idea/phpunit.xml new file mode 100644 index 0000000..4f8104c --- /dev/null +++ b/.idea/phpunit.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/examples/MessagesController.php b/examples/MessagesController.php index 95b66aa..4c94a46 100644 --- a/examples/MessagesController.php +++ b/examples/MessagesController.php @@ -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; diff --git a/readme.md b/readme.md index c84fc4a..b8bdd15 100644 --- a/readme.md +++ b/readme.md @@ -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) diff --git a/src/MessengerServiceProvider.php b/src/MessengerServiceProvider.php index 83ae0e4..a9b5058 100644 --- a/src/MessengerServiceProvider.php +++ b/src/MessengerServiceProvider.php @@ -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'); } }