Conditions | 2 |
Paths | 2 |
Total Lines | 20 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function send(SenderManagerContract $sender) |
||
42 | { |
||
43 | $model = app('notifynder.resolver.model')->getModel(Notification::class); |
||
44 | $table = (new $model())->getTable(); |
||
45 | |||
46 | $this->database->beginTransaction(); |
||
47 | $stackId = $this->database |
||
48 | ->table($table) |
||
49 | ->max('stack_id') + 1; |
||
50 | foreach ($this->notifications as $key => $notification) { |
||
51 | $this->notifications[$key] = $this->notifications[$key]->toDbArray(); |
||
52 | $this->notifications[$key]['stack_id'] = $stackId; |
||
53 | } |
||
54 | $insert = $this->database |
||
55 | ->table($table) |
||
56 | ->insert($this->notifications); |
||
57 | $this->database->commit(); |
||
58 | |||
59 | return (bool) $insert; |
||
60 | } |
||
61 | } |
||
62 |