-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
1 parent
3078af3
commit 74330ce
Showing
10 changed files
with
138 additions
and
5 deletions.
There are no files selected for viewing
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
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
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,22 @@ | ||
<?php | ||
|
||
namespace App\Notifications\Channels; | ||
|
||
use JPush\Client; | ||
use Illuminate\Notifications\Notification; | ||
|
||
class JPushChannel | ||
{ | ||
protected $client; | ||
|
||
public function __construct(Client $client) | ||
{ | ||
$this->client = $client; | ||
} | ||
|
||
public function send($notifiable, Notification $notification) | ||
{ | ||
$notification->toJPush($notifiable, $this->client->push())->send(); | ||
} | ||
} | ||
|
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
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,23 @@ | ||
<?php | ||
|
||
namespace App\Providers; | ||
|
||
use JPush\Client; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class JpushServiceProvider extends ServiceProvider | ||
{ | ||
public function boot() | ||
{ | ||
// | ||
} | ||
|
||
public function register() | ||
{ | ||
$this->app->singleton(Client::class, function ($app) { | ||
return new Client(config('jpush.key'), config('jpush.secret')); | ||
}); | ||
|
||
$this->app->alias(Client::class, 'jpush'); | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,6 @@ | ||
<?php | ||
|
||
return [ | ||
'key' => env('JPUSH_KEY'), | ||
'secret' => env('JPUSH_SECRET'), | ||
]; |
22 changes: 22 additions & 0 deletions
22
database/migrations/2020_08_07_225707_add_registration_id_to_users_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,22 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class AddRegistrationIdToUsersTable extends Migration | ||
{ | ||
public function up() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->string('registration_id')->nullable(); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::table('users', function (Blueprint $table) { | ||
$table->dropColumn('registration_id'); | ||
}); | ||
} | ||
} |