app/Http/Controllers/GuestController.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(Request $request)
    {
        if($request->has('status') && !empty($request->status)) {
            $status = $request->status;
            $guestContact = GuestContactInfo::where('status', $status)->orderBy('created_at','desc')->paginate(50);
        } else {
            $guestContact = GuestContactInfo::orderBy('created_at','desc')->paginate(20);
        }
        if($request->isXmlHttpRequest()) {
            return response(
                view('layouts.admin.guest_contact.table', ['guests' => $guestContact, 'count' => count($guestContact)]),
                200,
                ['Content-Type', 'application/json']
            );
        }
        return view('layouts.admin.guest_contact.index')
            ->with('guests', $guestContact)
            ->with('count', count($guestContact));
    }
public function index ( Request $ request ) { if ( $ request -> has ( 'status' ) && ! empty ( $ request -> status ) ) { $ status = $ request -> status ; $ guestContact = GuestContactInfo :: where ( 'status' , $ status ) -> orderBy ( 'created_at' , 'desc' ) -> paginate ( 50 ) ; } else { $ guestContact = GuestContactInfo :: orderBy ( 'created_at' , 'desc' ) -> paginate ( 20 ) ; } if ( $ request -> isXmlHttpRequest ( ) ) { return response ( view ( 'layouts.admin.guest_contact.table' , [ 'guests' => $ guestContact , 'count' => count ( $ guestContact ) ] ) , 200 , [ 'Content-Type' , 'application/json' ] ) ; } return view ( 'layouts.admin.guest_contact.index' ) -> with ( 'guests' , $ guestContact ) -> with ( 'count' , count ( $ guestContact ) ) ; }
Display a listing of the resource.
Display a listing of the resource .