Skip to content

Commit

Permalink
Merge pull request #20 from ARCANEDEV/updat-package
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc authored Oct 3, 2019
2 parents 565afe7 + 4b195b4 commit 4277a33
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 58 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions _docs/1-Installation-and-Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function up()
$table->morphs(config('messenger.users.morph', 'participable'));
$table->text('body');
$table->timestamps();
$table->softDeletes();
});
}
}
23 changes: 11 additions & 12 deletions src/LaravelMessengerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php namespace Arcanedev\LaravelMessenger;

use Arcanedev\Support\PackageServiceProvider;
use Arcanedev\Support\Providers\PackageServiceProvider;

/**
* Class LaravelMessengerServiceProvider
Expand Down Expand Up @@ -30,21 +30,20 @@ class LaravelMessengerServiceProvider extends PackageServiceProvider
/**
* Register the service provider.
*/
public function register()
public function register(): void
{
parent::register();

$this->registerConfig();

$this->bindModels();
}

/**
* Boot the service provider.
*/
public function boot()
public function boot(): void
{
parent::boot();

$this->publishConfig();

Messenger::$runsMigrations ? $this->loadMigrations() : $this->publishMigrations();
Expand All @@ -55,7 +54,7 @@ public function boot()
*
* @return array
*/
public function provides()
public function provides(): array
{
return [
Contracts\Discussion::class,
Expand All @@ -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"));
}
}
Expand Down
17 changes: 5 additions & 12 deletions src/Models/Discussion.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
* @package Arcanedev\LaravelMessenger\Models
* @author ARCANEDEV <[email protected]>
*
* @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
Expand All @@ -35,13 +35,6 @@
*/
class Discussion extends Model implements DiscussionContract
{
/* -----------------------------------------------------------------
| Traits
| -----------------------------------------------------------------
*/

use SoftDeletes;

/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
Expand Down
12 changes: 10 additions & 2 deletions src/Models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
Expand Down
8 changes: 8 additions & 0 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Arcanedev\LaravelMessenger\Models;

use Arcanedev\Support\Database\Model as BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
* Class Model
Expand All @@ -10,6 +11,13 @@
*/
abstract class Model extends BaseModel
{
/* -----------------------------------------------------------------
| Traits
| -----------------------------------------------------------------
*/

use SoftDeletes;

/* -----------------------------------------------------------------
| Constructor
| -----------------------------------------------------------------
Expand Down
16 changes: 4 additions & 12 deletions src/Models/Participation.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace Arcanedev\LaravelMessenger\Models;

use Arcanedev\LaravelMessenger\Contracts\Participation as ParticipantContract;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
* Class Participant
Expand All @@ -15,20 +14,13 @@
* @property string participable_type
* @property int participable_id
* @property \Illuminate\Database\Eloquent\Model participable
* @property \Carbon\Carbon last_read
* @property \Carbon\Carbon created_at
* @property \Carbon\Carbon updated_at
* @property \Carbon\Carbon deleted_at
* @property \Illuminate\Support\Carbon last_read
* @property \Illuminate\Support\Carbon created_at
* @property \Illuminate\Support\Carbon updated_at
* @property \Illuminate\Support\Carbon deleted_at
*/
class Participation extends Model implements ParticipantContract
{
/* -----------------------------------------------------------------
| Traits
| -----------------------------------------------------------------
*/

use SoftDeletes;

/* -----------------------------------------------------------------
| Properties
| -----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions tests/LaravelMessengerServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function it_can_be_instantiated()
{
$expectations = [
\Illuminate\Support\ServiceProvider::class,
\Arcanedev\Support\ServiceProvider::class,
\Arcanedev\Support\PackageServiceProvider::class,
\Arcanedev\Support\Providers\ServiceProvider::class,
\Arcanedev\Support\Providers\PackageServiceProvider::class,
\Arcanedev\LaravelMessenger\LaravelMessengerServiceProvider::class,
];

Expand Down

0 comments on commit 4277a33

Please sign in to comment.