Issues (465)

app/Http/Controllers/ChatController.php (6 issues)

1
<?php
2
3
namespace App\Http\Controllers;
4
5
use App\Events\ChatMessageSentEvent;
6
use App\Models\Chat;
7
use Illuminate\Http\Request;
8
9
class ChatController extends Controller
10
{
11
    /**
12
     * Display a listing of the resource.
13
     *
14
     * @return \Illuminate\Http\Response
15
     */
16
    public function index(Request $request)
17
    {
18
        $requester = $request->user();
19
20
        return $requester->userChats();
21
    }
22
23
    /**
24
     * Show the form for creating a new resource.
25
     *
26
     * @return \Illuminate\Http\Response
27
     */
28
    public function test()
29
    {
30
        $event = new ChatMessageSentEvent();
31
        event($event);
32
        dd('here');
33
    }
34
35
    public function create()
36
    {
37
        //
38
    }
39
40
    /**
41
     * Store a newly created resource in storage.
42
     *
43
     * @param  \Illuminate\Http\Request  $request
44
     * @return \Illuminate\Http\Response
45
     */
46
    public function store(Request $request)
47
    {
48
        $event = new ChatMessageSentEvent();
49
        broadcast($event);
50
51
        return $request->all();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $request->all() returns the type array which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
52
    }
53
54
    /**
55
     * Display the specified resource.
56
     *
57
     * @param  \App\Models\Chat  $chat
58
     * @return \Illuminate\Http\Response
59
     */
60
    public function show(Chat $chat)
0 ignored issues
show
The parameter $chat is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function show(/** @scrutinizer ignore-unused */ Chat $chat)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
61
    {
62
        //
63
    }
64
65
    /**
66
     * Show the form for editing the specified resource.
67
     *
68
     * @param  \App\Models\Chat  $chat
69
     * @return \Illuminate\Http\Response
70
     */
71
    public function edit(Chat $chat)
0 ignored issues
show
The parameter $chat is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

71
    public function edit(/** @scrutinizer ignore-unused */ Chat $chat)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
72
    {
73
        //
74
    }
75
76
    /**
77
     * Update the specified resource in storage.
78
     *
79
     * @param  \Illuminate\Http\Request  $request
80
     * @param  \App\Models\Chat  $chat
81
     * @return \Illuminate\Http\Response
82
     */
83
    public function update(Request $request, Chat $chat)
0 ignored issues
show
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    public function update(/** @scrutinizer ignore-unused */ Request $request, Chat $chat)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $chat is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

83
    public function update(Request $request, /** @scrutinizer ignore-unused */ Chat $chat)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
84
    {
85
        //
86
    }
87
88
    /**
89
     * Remove the specified resource from storage.
90
     *
91
     * @param  \App\Models\Chat  $chat
92
     * @return \Illuminate\Http\Response
93
     */
94
    public function destroy(Chat $chat)
0 ignored issues
show
The parameter $chat is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

94
    public function destroy(/** @scrutinizer ignore-unused */ Chat $chat)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
95
    {
96
        //
97
    }
98
}
99