Issues (17)

src/Messenger.php (16 issues)

Labels
Severity
1
<?php namespace GeneaLabs\LaravelMessenger;
2
3
use Illuminate\View\View;
4
5
class Messenger
6
{
7
    public function deliver() : View
8
    {
9
        $message = session('genealabs-laravel-messenger.message');
10
        session()->forget('genealabs-laravel-messenger.message');
11
12
        if (! $message) {
13
            return view("genealabs-laravel-messenger::empty");
14
        }
15
16
        return view("genealabs-laravel-messenger::{$message->framework}.{$message->type}")->with([
0 ignored issues
show
The property type does not seem to exist on Illuminate\Session\Store.
Loading history...
The property type does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
The property framework does not seem to exist on Illuminate\Session\Store.
Loading history...
The property framework does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
17
            'autoHide' => $message->autoHide,
0 ignored issues
show
The property autoHide does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
The property autoHide does not seem to exist on Illuminate\Session\Store.
Loading history...
18
            "id" => $message->id,
0 ignored issues
show
The property id is declared protected in Illuminate\Session\Store and cannot be accessed from this context.
Loading history...
The property id does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
19
            'message' => $message->message,
0 ignored issues
show
The property message does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
The property message does not seem to exist on Illuminate\Session\Store.
Loading history...
20
            'level' => $message->level,
0 ignored issues
show
The property level does not seem to exist on Illuminate\Session\Store.
Loading history...
The property level does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
21
            'section' => $message->section,
0 ignored issues
show
The property section does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
The property section does not seem to exist on Illuminate\Session\Store.
Loading history...
22
            'title' => $message->title,
0 ignored issues
show
The property title does not seem to exist on Illuminate\Session\SessionManager.
Loading history...
The property title does not seem to exist on Illuminate\Session\Store.
Loading history...
23
        ]);
24
    }
25
26
    public function send(
27
        string $text,
28
        string $title = null,
29
        string $level = null,
30
        bool $autoHide = null,
31
        string $framework = null,
32
        string $type = null
33
    ) {
34
        $message = new Message([
35
            'message' => $text,
36
            'title' => $title,
37
            'level' => $level,
38
            'autoHide' => $autoHide,
39
            'framework' => $framework,
40
            'type' => $type,
41
        ]);
42
43
        if ($text) {
44
            session(['genealabs-laravel-messenger.message' => $message]);
45
        }
46
    }
47
}
48