app/Http/Controllers/Dashboard/ChatController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        if (request()->ajax()) {
            $messages = Chatimages::orderBy('id', 'asc')->where('from_id', request('from_id'))->where('to_id', request('to_id'))->orwhere('to_id', request('from_id'))->Where('from_id', request('to_id'))->get();
            if ($messages) {
                return response()->json([
                    'status' => 'success',
                    'messages' => $messages,
                ]);
            } else {
                return response()->json(['status' => 'error']);
            }
        }
        return view('dashboard.chat.create');
    }
public function index ( ) { if ( request ( ) -> ajax ( ) ) { $ messages = Chatimages :: orderBy ( 'id' , 'asc' ) -> where ( 'from_id' , request ( 'from_id' ) ) -> where ( 'to_id' , request ( 'to_id' ) ) -> orwhere ( 'to_id' , request ( 'from_id' ) ) -> Where ( 'from_id' , request ( 'to_id' ) ) -> get ( ) ; if ( $ messages ) { return response ( ) -> json ( [ 'status' => 'success' , 'messages' => $ messages , ] ) ; } else { return response ( ) -> json ( [ 'status' => 'error' ] ) ; } } return view ( 'dashboard.chat.create' ) ; }
Display a listing of the resource.
Display a listing of the resource .