diff --git a/README.md b/README.md index a96adae..5276e20 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This Laravel Messenger will allow you to add a messaging system into your Larave * Easy setup & configuration. * Well documented & IDE Friendly. * Well tested with maximum code quality. - * Laravel `5.1` to `6.0` are supported. + * Laravel `5.1` to `6.x` are supported. * Made with :heart: & :coffee:. ## Table of contents @@ -45,7 +45,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail. - [All Contributors][link-contributors] - [cmgmyr/laravel-messenger](https://github.com/cmgmyr/laravel-messenger) -[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%206.0-orange.svg?style=flat-square +[badge_laravel]: https://img.shields.io/badge/Laravel-5.1%20to%206.x-orange.svg?style=flat-square [badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-messenger.svg?style=flat-square [badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelMessenger.svg?style=flat-square [badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelMessenger.svg?style=flat-square diff --git a/_docs/0-Home.md b/_docs/0-Home.md index f8c70c4..5cb85ca 100644 --- a/_docs/0-Home.md +++ b/_docs/0-Home.md @@ -8,7 +8,7 @@ This Laravel Messenger will allow you to add a messaging system into your Larave * Easy setup & configuration. * Well documented & IDE Friendly. * Well tested with maximum code quality. - * Laravel `5.1` to `6.0` are supported. + * Laravel `5.1` to `6.x` are supported. * Made with :heart: & :coffee:. ## Table of contents diff --git a/_docs/1-Installation-and-Setup.md b/_docs/1-Installation-and-Setup.md index 5b4c6a9..0d2f242 100644 --- a/_docs/1-Installation-and-Setup.md +++ b/_docs/1-Installation-and-Setup.md @@ -16,7 +16,7 @@ | ![LaravelMessenger v4.x][laravel_messenger_4_x] | ![Laravel v5.6][laravel_5_6] | | ![LaravelMessenger v5.x][laravel_messenger_5_x] | ![Laravel v5.7][laravel_5_7] | | ![LaravelMessenger v6.x][laravel_messenger_6_x] | ![Laravel v5.8][laravel_5_8] | -| ![LaravelMessenger v7.x][laravel_messenger_7_x] | ![Laravel v6.0][laravel_6_0] | +| ![LaravelMessenger v7.x][laravel_messenger_7_x] | ![Laravel v6.x][laravel_6_x] | [laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1" [laravel_5_2]: https://img.shields.io/badge/v5.2-supported-brightgreen.svg?style=flat-square "Laravel v5.2" @@ -26,15 +26,15 @@ [laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6" [laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7" [laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8" -[laravel_6_0]: https://img.shields.io/badge/v6.0-supported-brightgreen.svg?style=flat-square "Laravel v6.0" - -[laravel_messenger_1_x]: https://img.shields.io/badge/version-1.*-blue.svg?style=flat-square "LaravelMessenger v1.*" -[laravel_messenger_2_x]: https://img.shields.io/badge/version-2.*-blue.svg?style=flat-square "LaravelMessenger v2.*" -[laravel_messenger_3_x]: https://img.shields.io/badge/version-3.*-blue.svg?style=flat-square "LaravelMessenger v3.*" -[laravel_messenger_4_x]: https://img.shields.io/badge/version-4.*-blue.svg?style=flat-square "LaravelMessenger v4.*" -[laravel_messenger_5_x]: https://img.shields.io/badge/version-5.*-blue.svg?style=flat-square "LaravelMessenger v5.*" -[laravel_messenger_6_x]: https://img.shields.io/badge/version-6.*-blue.svg?style=flat-square "LaravelMessenger v6.*" -[laravel_messenger_7_x]: https://img.shields.io/badge/version-7.*-blue.svg?style=flat-square "LaravelMessenger v7.*" +[laravel_6_x]: https://img.shields.io/badge/v6.x-supported-brightgreen.svg?style=flat-square "Laravel v6.x" + +[laravel_messenger_1_x]: https://img.shields.io/badge/version-1.x-blue.svg?style=flat-square "LaravelMessenger v1.x" +[laravel_messenger_2_x]: https://img.shields.io/badge/version-2.x-blue.svg?style=flat-square "LaravelMessenger v2.x" +[laravel_messenger_3_x]: https://img.shields.io/badge/version-3.x-blue.svg?style=flat-square "LaravelMessenger v3.x" +[laravel_messenger_4_x]: https://img.shields.io/badge/version-4.x-blue.svg?style=flat-square "LaravelMessenger v4.x" +[laravel_messenger_5_x]: https://img.shields.io/badge/version-5.x-blue.svg?style=flat-square "LaravelMessenger v5.x" +[laravel_messenger_6_x]: https://img.shields.io/badge/version-6.x-blue.svg?style=flat-square "LaravelMessenger v6.x" +[laravel_messenger_7_x]: https://img.shields.io/badge/version-7.x-blue.svg?style=flat-square "LaravelMessenger v7.x" ## Composer diff --git a/composer.json b/composer.json index 5fb5ef5..34a7f72 100644 --- a/composer.json +++ b/composer.json @@ -17,13 +17,13 @@ "license": "MIT", "require": { "php": ">=7.2.0", - "arcanedev/support": "~5.0.0" + "arcanedev/support": "^5.0" }, "require-dev": { - "orchestra/testbench": "~4.0.0", - "mockery/mockery": "~1.2", - "phpunit/phpunit": "~8.0", - "phpunit/phpcov": "~6.0" + "orchestra/testbench": "^4.0", + "mockery/mockery": "^1.2", + "phpunit/phpunit": "^8.0", + "phpunit/phpcov": "^6.0" }, "autoload": { "psr-4": { diff --git a/database/migrations/2016_08_01_000002_create_messages_table.php b/database/migrations/2016_08_01_000002_create_messages_table.php index 03c79ae..47ac5d0 100644 --- a/database/migrations/2016_08_01_000002_create_messages_table.php +++ b/database/migrations/2016_08_01_000002_create_messages_table.php @@ -45,6 +45,7 @@ public function up() $table->morphs(config('messenger.users.morph', 'participable')); $table->text('body'); $table->timestamps(); + $table->softDeletes(); }); } } diff --git a/src/LaravelMessengerServiceProvider.php b/src/LaravelMessengerServiceProvider.php index 751d038..f4c33e3 100644 --- a/src/LaravelMessengerServiceProvider.php +++ b/src/LaravelMessengerServiceProvider.php @@ -1,6 +1,6 @@ registerConfig(); + $this->bindModels(); } /** * Boot the service provider. */ - public function boot() + public function boot(): void { - parent::boot(); - $this->publishConfig(); Messenger::$runsMigrations ? $this->loadMigrations() : $this->publishMigrations(); @@ -55,7 +54,7 @@ public function boot() * * @return array */ - public function provides() + public function provides(): array { return [ Contracts\Discussion::class, @@ -72,16 +71,16 @@ public function provides() /** * Bind the models. */ - private function bindModels() + private function bindModels(): void { - $config = $this->config(); + $config = $this->app['config']; $bindings = [ - 'discussions' => Contracts\Discussion::class, - 'messages' => Contracts\Message::class, - 'participations' => Contracts\Participation::class, + Contracts\Discussion::class => 'discussions', + Contracts\Message::class => 'messages', + Contracts\Participation::class => 'participations', ]; - foreach ($bindings as $key => $contract) { + foreach ($bindings as $contract => $key) { $this->bind($contract, $config->get("{$this->package}.{$key}.model")); } } diff --git a/src/Models/Discussion.php b/src/Models/Discussion.php index 4b375e3..492a4cc 100644 --- a/src/Models/Discussion.php +++ b/src/Models/Discussion.php @@ -16,11 +16,11 @@ * @package Arcanedev\LaravelMessenger\Models * @author ARCANEDEV * - * @property int id - * @property string subject - * @property \Carbon\Carbon created_at - * @property \Carbon\Carbon updated_at - * @property \Carbon\Carbon deleted_at + * @property int id + * @property string subject + * @property \Illuminate\Support\Carbon created_at + * @property \Illuminate\Support\Carbon updated_at + * @property \Illuminate\Support\Carbon deleted_at * * @property \Illuminate\Database\Eloquent\Model creator * @property \Illuminate\Database\Eloquent\Collection messages @@ -35,13 +35,6 @@ */ class Discussion extends Model implements DiscussionContract { - /* ----------------------------------------------------------------- - | Traits - | ----------------------------------------------------------------- - */ - - use SoftDeletes; - /* ----------------------------------------------------------------- | Properties | ----------------------------------------------------------------- diff --git a/src/Models/Message.php b/src/Models/Message.php index 7e4703e..87591e1 100644 --- a/src/Models/Message.php +++ b/src/Models/Message.php @@ -13,8 +13,9 @@ * @property string participable_type * @property int participable_id * @property int body - * @property \Carbon\Carbon created_at - * @property \Carbon\Carbon updated_at + * @property \Illuminate\Support\Carbon created_at + * @property \Illuminate\Support\Carbon updated_at + * @property \Illuminate\Support\Carbon deleted_at * * @property \Arcanedev\LaravelMessenger\Models\Discussion discussion * @property \Illuminate\Database\Eloquent\Model participable @@ -46,6 +47,13 @@ class Message extends Model implements MessageContract 'body', ]; + /** + * The attributes that should be mutated to dates. + * + * @var array + */ + protected $dates = ['deleted_at']; + /** * The attributes that should be cast to native types. * diff --git a/src/Models/Model.php b/src/Models/Model.php index 1e6c46a..f2d0168 100644 --- a/src/Models/Model.php +++ b/src/Models/Model.php @@ -1,6 +1,7 @@