Blame view
app/Http/Controllers/HomeController.php
1.15 KB
02a1ed535 Первый коммит Rek... |
1 2 3 |
<?php namespace App\Http\Controllers; |
f98ccb92c Массова рассылка |
4 |
use App\Models\Message; |
02a1ed535 Первый коммит Rek... |
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
use Illuminate\Http\Request; class HomeController extends Controller { /** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth'); } /** * Show the application dashboard. * * @return \Illuminate\Contracts\Support\Renderable */ public function index() { return view('home'); } |
f98ccb92c Массова рассылка |
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
public function send_message(Request $request) { $user_id = Auth()->user()->id; $message_params = [ 'text' => $request->input('text'), 'reply_message_id' => $request->input('reply_message_id', null), ]; $new_message = Message::add_message( $request, $user_id, $request->input('to_user_id'), $message_params ); $user_type = Auth()->user()->is_worker ? 'worker' : 'employer'; return response()->json([ 'success' => true, |
47f75ed34 правки |
49 |
'url_redirect' => route($user_type . '.dialog', ['chat' => $new_message->chat_id_from]) |
f98ccb92c Массова рассылка |
50 51 |
]); } |
02a1ed535 Первый коммит Rek... |
52 |
} |