| 1 | <?php |
||
| 7 | class ChatController extends Controller |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Create a new controller instance. |
||
| 11 | * |
||
| 12 | * @return void |
||
|
|
|||
| 13 | */ |
||
| 14 | public function __construct() |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Show the application dashboard. |
||
| 21 | * |
||
| 22 | * @return \Illuminate\Http\Response |
||
| 23 | */ |
||
| 24 | public function index(Request $request) |
||
| 25 | { |
||
| 26 | $conversations = Chat::conversation(Chat::conversations()->conversation) |
||
| 27 | ->for(auth()->user()) |
||
| 28 | ->get() |
||
| 29 | ->toArray()['data']; |
||
| 30 | $conversations = array_pluck($conversations, 'id'); |
||
| 31 | return view('home', compact('conversations')); |
||
| 32 | } |
||
| 33 | |||
| 34 | public function history($toId) |
||
| 39 | |||
| 40 | public function send($toId) |
||
| 48 | } |
||
| 49 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.