app/Http/Controllers/TenancyController.php
/**
     * @param Tenancy $tenancy
     * @return JsonResponse|View
     * @throws AuthorizationException
     */
@param Tenancy $tenancy
@return JsonResponse|View
@throws AuthorizationException
@param Tenancy $tenancy @return JsonResponse|View @throws AuthorizationException
public function show(Tenancy $tenancy)
    {
        $this->authorize('view', $tenancy);
        $locale = Cookie::get('locale', 'en');
        $tenancy = Tenancy::where('id', $tenancy->id)->with('property', 'tenant')->get();
        if (request()->ajax()) {
            return Response::json([
                'locale' => $locale,
                'tenancy' => $tenancy,
            ]);
        }
        return view('tenancy.show');
    }
public function show ( Tenancy $ tenancy ) { $ this -> authorize ( 'view' , $ tenancy ) ; $ locale = Cookie :: get ( 'locale' , 'en' ) ; $ tenancy = Tenancy :: where ( 'id' , $ tenancy -> id ) -> with ( 'property' , 'tenant' ) -> get ( ) ; if ( request ( ) -> ajax ( ) ) { return Response :: json ( [ 'locale' => $ locale , 'tenancy' => $ tenancy , ] ) ; } return view ( 'tenancy.show' ) ; }
@param Tenancy $tenancy
 @return JsonResponse|View
 @throws AuthorizationException
@param Tenancy $tenancy @return JsonResponse|View @throws AuthorizationException