Skip to content

Commit

Permalink
trait replaced with macro
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed May 9, 2024
1 parent 169c040 commit d7ff071
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
return new class extends Migration {
/**
* Run the migrations.
*/
Expand Down
17 changes: 9 additions & 8 deletions src/ChatServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Fintech\Chat;

use Fintech\Chat\Commands\InstallCommand;
use Fintech\Chat\Providers\RepositoryServiceProvider;
use Fintech\Core\Traits\RegisterPackageTrait;
use Illuminate\Support\ServiceProvider;

Expand All @@ -20,10 +21,10 @@ public function register()
$this->packageCode = 'chat';

$this->mergeConfigFrom(
__DIR__.'/../config/chat.php', 'fintech.chat'
__DIR__ . '/../config/chat.php', 'fintech.chat'
);

$this->app->register(\Fintech\Chat\Providers\RepositoryServiceProvider::class);
$this->app->register(RepositoryServiceProvider::class);
}

/**
Expand All @@ -34,21 +35,21 @@ public function boot(): void
$this->injectOnConfig();

$this->publishes([
__DIR__.'/../config/chat.php' => config_path('fintech/chat.php'),
__DIR__ . '/../config/chat.php' => config_path('fintech/chat.php'),
]);

$this->loadMigrationsFrom(__DIR__.'/../database/migrations');
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');

$this->loadTranslationsFrom(__DIR__.'/../lang', 'chat');
$this->loadTranslationsFrom(__DIR__ . '/../lang', 'chat');

$this->publishes([
__DIR__.'/../lang' => $this->app->langPath('vendor/chat'),
__DIR__ . '/../lang' => $this->app->langPath('vendor/chat'),
]);

$this->loadViewsFrom(__DIR__.'/../resources/views', 'chat');
$this->loadViewsFrom(__DIR__ . '/../resources/views', 'chat');

$this->publishes([
__DIR__.'/../resources/views' => resource_path('views/vendor/chat'),
__DIR__ . '/../resources/views' => resource_path('views/vendor/chat'),
]);

if ($this->app->runningInConsole()) {
Expand Down
4 changes: 2 additions & 2 deletions src/Exceptions/ChatException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ChatException extends Exception
/**
* CoreException constructor.
*
* @param string $message
* @param int $code
* @param string $message
* @param int $code
*/
public function __construct($message = '', $code = 0, ?Throwable $previous = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/ChatGroupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function update(int|string $id, array $attributes = []);
/**
* find and delete a entry from records
*
* @param bool $onlyTrashed
* @param bool $onlyTrashed
* @return BaseModel
*/
public function find(int|string $id, $onlyTrashed = false);
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/ChatMessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function update(int|string $id, array $attributes = []);
/**
* find and delete a entry from records
*
* @param bool $onlyTrashed
* @param bool $onlyTrashed
* @return BaseModel
*/
public function find(int|string $id, $onlyTrashed = false);
Expand Down
2 changes: 1 addition & 1 deletion src/Interfaces/ChatParticipantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function update(int|string $id, array $attributes = []);
/**
* find and delete a entry from records
*
* @param bool $onlyTrashed
* @param bool $onlyTrashed
* @return BaseModel
*/
public function find(int|string $id, $onlyTrashed = false);
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/Eloquent/ChatGroupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/Eloquent/ChatMessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/Repositories/Eloquent/ChatParticipantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/Mongodb/ChatGroupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
{
$model = app(config('fintech.chat.chat_group_model', ChatGroup::class));

if (! $model instanceof Model) {
if (!$model instanceof Model) {
throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance.");
}

Expand All @@ -37,7 +37,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/Mongodb/ChatMessageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
{
$model = app(config('fintech.chat.chat_message_model', ChatMessage::class));

if (! $model instanceof Model) {
if (!$model instanceof Model) {
throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance.");
}

Expand All @@ -37,7 +37,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/Repositories/Mongodb/ChatParticipantRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct()
{
$model = app(config('fintech.chat.chat_participant_model', ChatParticipant::class));

if (! $model instanceof Model) {
if (!$model instanceof Model) {
throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance.");
}

Expand All @@ -37,7 +37,7 @@ public function list(array $filters = [])
$query = $this->model->newQuery();

//Searching
if (! empty($filters['search'])) {
if (!empty($filters['search'])) {
if (is_numeric($filters['search'])) {
$query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%");
} else {
Expand Down

0 comments on commit d7ff071

Please sign in to comment.