File size: 649 Bytes
89a1081
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

namespace App\Traits;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Validation\ValidationException;

trait Notifyable
{
    protected function notify(array $notifications) :void {

        foreach ($notifications as $notification => $config) {

            if (notify($notification)) {

                $action = $config['action'];
                $params = $config['params'];
        
                foreach ($params as $paramSet) {

                    if ($paramSet) {

                        call_user_func_array($action, $paramSet);
                    }
                }
            }
        }
    }
}