Laravel 5 View is loading from cache and new code not affecting

7k views Asked by At

I have been working in my Vagrant development environment and the Laravel 5 app is working fine. When I uploaded the app to my DO Ubuntu 14.14 droplet, its loading the View from cache and when I update the view blade template, its not affecting the site.

I've searched for solution but didn't found anything. Now sure how to stop caching the view or refresh the cache.

Error:

ErrorException in 61093154cb848bf7f33155b09ac70c93 line 132: Undefined property: Illuminate\Database\Eloquent\Collection::$profile_picture (View: /var/www/demo/property/public/resources/views/user/account/acc.blade.php)

    in 61093154cb848bf7f33155b09ac70c93 line 132
    at CompilerEngine->handleViewException(object(ErrorException), '1') in PhpEngine.php line 43
    at PhpEngine->evaluatePath('/var/www/demo/property/public/storage/framework/views/61093154cb848bf7f33155b09ac70c93', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'User Account', 'profile' => object(Collection))) in CompilerEngine.php line 57
    at CompilerEngine->get('/var/www/demo/property/public/resources/views/user/account/acc.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'page_title' => 'User Account', 'profile' => object(Collection))) in View.php line 136
    at View->getContents() in View.php line 104
    at View->renderContents() in View.php line 78
    at View->render() in Response.php line 44
    at Response->setContent(object(View)) in Response.php line 202
    at Response->__construct(object(View)) in Router.php line 1198
    at Router->prepareResponse(object(Request), object(View)) in Router.php line 702
    at Router->Illuminate\Routing\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Authenticate.php line 47
    at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
    at Pipeline->then(object(Closure)) in Router.php line 703
    at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 670
    at Router->dispatchToRoute(object(Request)) in Router.php line 628
    at Router->dispatch(object(Request)) in Kernel.php line 214
    at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in VerifyCsrfToken.php line 43
    at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17
    at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
    at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
    at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
    at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
    at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
    at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
    at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
    at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
    at Pipeline->then(object(Closure)) in Kernel.php line 115
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
    at Kernel->handle(object(Request)) in index.php line 53

After the error, I've updated the line 132 but its not affecting. I tried by removing all content from the acc.blade.php file but still I get the error.

1

There are 1 answers

4
Kyslik On BEST ANSWER

I made a package (artisan command) for clearing views because it was really annoying to clear them manually.

https://github.com/Kyslik/view-clear

when installed just $ php artisan view:clear

If you are using Laravel 5.1.* you don't need this package since it is part of Laravel base commands.


Perhaps browser itself is doing some caching, so use "hard reload" or "hard refresh" using ctrl+f5 (ctrl+r) on windows or shift+command+r on osx.