-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ba7f262
Showing
51 changed files
with
2,152 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
use App\Models\User; | ||
|
||
return [ | ||
'name' => 'Notifications', | ||
|
||
'types' => [ | ||
[ | ||
"name" => "Alert", | ||
"id" => "alert", | ||
"color" => "#fff", | ||
"icon" => "bx bxs-user" | ||
], | ||
[ | ||
"name" => "Info", | ||
"id" => "info", | ||
"color" => "#fff", | ||
"icon" => "bx bxs-user" | ||
], | ||
[ | ||
"name" => "Danger", | ||
"id" => "danger", | ||
"color" => "#fff", | ||
"icon" => "bx bxs-user" | ||
], | ||
[ | ||
"name" => "Success", | ||
"id" => "success", | ||
"color" => "#fff", | ||
"icon" => "bx bxs-user" | ||
], | ||
[ | ||
"name" => "Warring", | ||
"id" => "warring", | ||
"color" => "#fff", | ||
"icon" => "bx bxs-user" | ||
], | ||
], | ||
|
||
'provider' => "pusher", | ||
|
||
'models' => [ | ||
User::class | ||
], | ||
|
||
'slack' => [ | ||
"hook" => env('SLACK_HOOK', null), | ||
"reporting" => env('SLACK_REPORTING', false), | ||
] | ||
]; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
namespace Modules\Notifications\Console; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class InstallNotifications extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'notifications:install'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Install notifications permissions'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->info('Install Permissions'); | ||
Artisan::call('roles:generate user_notifications'); | ||
Artisan::call('roles:generate notifiactions_templates'); | ||
Artisan::call('roles:generate notifications_logs'); | ||
$this->info('Your Notifications is ready now'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return []; | ||
} | ||
} |
Empty file.
47 changes: 47 additions & 0 deletions
47
Database/Migrations/2022_05_29_031439_create_user_notifications_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('user_notifications', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
//If Selected Record On the model | ||
$table->string('model_type')->nullable(); | ||
$table->unsignedBigInteger('model_id')->nullable(); | ||
|
||
//Else on public | ||
$table->string('title')->nullable(); | ||
$table->string('url')->nullable(); | ||
$table->string('icon')->default('bx bx-user')->nullable(); | ||
$table->string('description')->nullable(); | ||
$table->string('type')->default('info'); | ||
$table->string('privacy')->default('public'); | ||
|
||
//If Created By | ||
$table->unsignedBigInteger('created_by')->nullable(); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('user_notifications'); | ||
} | ||
}; |
39 changes: 39 additions & 0 deletions
39
Database/Migrations/2022_05_29_032309_create_user_has_notifications_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('user_has_notifications', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
//If Selected Record On the model | ||
$table->string('model_type'); | ||
$table->unsignedBigInteger('model_id'); | ||
|
||
$table->string('provider')->default('pusher')->nullable(); | ||
$table->string('provider_token')->nullable(); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('user_has_notifications'); | ||
} | ||
}; |
40 changes: 40 additions & 0 deletions
40
Database/Migrations/2022_05_29_032652_create_user_read_notifications_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('user_read_notifications', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
//If Selected Record On the model | ||
$table->string('model_type'); | ||
$table->unsignedBigInteger('model_id'); | ||
$table->unsignedBigInteger('notification_id'); | ||
|
||
$table->boolean('read')->default(false); | ||
$table->boolean('open')->default(false); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('user_read_notifications'); | ||
} | ||
}; |
34 changes: 34 additions & 0 deletions
34
Database/Migrations/2022_05_29_032817_create_foreign_notifications_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('user_notifications', function (Blueprint $table) { | ||
$table->foreign('created_by')->references('id')->on('users')->onDelete('cascade'); | ||
}); | ||
|
||
Schema::table('user_read_notifications', function (Blueprint $table) { | ||
$table->foreign('notification_id')->references('id')->on('user_notifications')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('foreign_notifications'); | ||
} | ||
}; |
49 changes: 49 additions & 0 deletions
49
Database/Migrations/2022_06_13_172930_create_notifiactions_templates_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('notifiactions_templates', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('name'); | ||
$table->string('key')->unique(); | ||
$table->text('body'); | ||
$table->string('title')->nullable(); | ||
$table->string('url')->nullable(); | ||
$table->string('icon')->nullable(); | ||
$table->string('type')->default('info')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
|
||
Schema::table('user_notifications', function (Blueprint $table) { | ||
if (Schema::hasColumn('notifiactions_templates', 'template_id')) { | ||
$table->unsignedBigInteger('template_id'); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('notifiactions_templates'); | ||
Schema::table('user_notifications', function (Blueprint $table) { | ||
if (Schema::hasColumn('notifiactions_templates', 'template_id')) { | ||
$table->dropColumn('template_id'); | ||
} | ||
}); | ||
} | ||
}; |
36 changes: 36 additions & 0 deletions
36
Database/Migrations/2022_06_22_114851_update_notification_template_field_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
if (!Schema::hasColumn('user_notifications', 'template_id')) { | ||
Schema::table('user_notifications', function (Blueprint $table) { | ||
$table->unsignedBigInteger('template_id'); | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
if (!Schema::hasColumn('user_notifications', 'template_id')) { | ||
Schema::table('user_notifications', function (Blueprint $table) { | ||
$table->dropColumn('template_id'); | ||
}); | ||
} | ||
} | ||
}; |
Oops, something went wrong.