Advertisement
kemple99

Untitled

Aug 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Http\Controllers;
  4.  
  5. use App\Http\Requests\NotifRequest;
  6. use App\Models\Notif;
  7. use App\Models\User;
  8. use App\Notifications\AssignOpportunity;
  9. use Illuminate\Support\Facades\Auth;
  10. use Illuminate\Support\Facades\Notification;
  11.  
  12. class NotifController extends Controller
  13. {
  14.  
  15.     public function assignOpportunity()
  16.     {
  17.         // $devicekeys = [];
  18.         // foreach ($users as $user) {
  19.         //     array_push($devicekeys, $user->devicekey->pluck('key'));
  20.         // };
  21.  
  22.         $user = User::find(1);
  23.         $devicekeys = $user->devicekey->pluck('key');
  24.  
  25.         // nanti pake ini kalo udah bisa input user
  26.         // $admins = User::all()->filter(function ($user) {
  27.         //    return $user->hasRole('super_admin');
  28.         // });
  29.  
  30.         Notification::send($user, new AssignOpportunity('Test', $devicekeys));
  31.  
  32.         return $user;
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement