laravel file is not updating - laravel

i have been working on my project for several week. everything was fine. but today all of a sudden i can not load some of my changed views (some i can change and get result). even if i change the controller, its still now working. according to SO and some other site i have tried followings
restart browser
clear browser cache, history(even tried new browser)
php artisan cache:clear
php artisan view:clear
composer dumpautoload
delete all files from storage/framework/views folder
delete all files from storage/framework/sessions folder
restart nginx server
what did i miss. thanks in advance.

Run php artisan view:clear command to clear views cache. If this won't help, delete all php files in storage/framework/views directory.
Another thing you should do is to check if you're calling the view you want. It happens in big projects with a similar views. Use Laravel Debugbar to display actually loaded views.

Related

Laravel View Cache keeps interrupting

I'm doing my thing in my normal view blade file, but when i edit my code and save it, it doesn't update. I found out that the view cache stored in /storage/framework/views keeps interrupting. Whatever i change in my normal blade file doesn't change the output. It only reacts to my cache, which doesn't update. I've already cleared my cache, but it doesn't work, it keeps coming back. Is there any way i can ignore or delete the view cache?
php artisan clear
php artisan route:clear
php artisan cache:clear
Run the above codes in your terminal it should do the trick, if it persists try reloading your editor.
Thanks for trying to help! The issue is gone now. Somehow i had 2 of the same blade files and i edited the wrong one, which is really weird. I don't know how i had 2 of the same blade files. I deleted one and now it works fine. Really weird though.
php artisan cache:clear
Try this.

How tu run laravel php artisan serve with fresh cache

I am using php artisan serve to start my mini app on my remote server.
Once I update code, I am using ftp to upload new code.
After upload I am stop and restart (php artisan serve), but view are still "old", there is something like cache, how can I clear it?
try php artisan optimize:clear
If You want to clear file cache then you can use clearstatcache().If you are checking a file several times in a script, to avoid caching & to get correct results, use the clearstatcache() function. see more here
But if you want clear browser cache then you can delete it using headers.
see more here

I am seeing old laravel site even after updating files

I have a website that uses vuejs as frontend and Laravel API in backend. Recently I updated my Laravel site it was working absolutely fine in my localhost. But the problem is when I upload my Laravel files to my hostinger.com hosting account it's not updating. It's displaying me old site but my database got updated and I was able to errors of the new site.
I tried these none of them seems to be working,
Cleared browser history and cache
Tried reuploading site again
I ran following commands
php artisan config:cache
php artisan route:cache
php artisan view:cache
npm run prod
Tried to use cmd command ipconfig/flushdns
Still, I was not able to solve the issue.
Have you tried refreshing your website with CTRL+F5 or CTRL+R ?

Blade view not reflecting changes

I am developing a Laravel(5.2.29) project in Windows environment and testing it on Chrome browser.
I have made some changes on a Blade file using atom text editor and then refreshed my page and noticed that suddenly it has stopped reflecting the changes (it's loading the old Blade file).
I've tried the following:
Restarted the browser
Clearing browser cache
Running php artisan cache:clear
Running composer dumpautoload
Deleting the Blade file (and got a view not found error). Then created a new Blade file with the same name, with no content and refreshed the page.
No matter what, the code displayed on the browser is always the same (old) version and not the content of the Blade file.
How can I solve this issue?
In order to avoid the parsing of Blade files on each reload, Laravel caches the views after Blade is processed. I've experienced some situations where the source (view file) is updated but the cache file is not "reloaded". In these cases, all you need to do is to delete the cached views and reload the page.
The cached view files are stored in storage/framework/views.
Run this command from terminal
php artisan view:clear
If you use PhpStorm, uncheck Preserve files timestamps deployment option:
https://stackoverflow.com/a/42534996/2453148
php artisan cache:clear
php artisan route:cache
php artisan config:clear
php artisan view:clear
rm -rf bootstrap/cache/*/*
Delete Cache/OPcache from PHP (fpm) of your Nginx/Apache server.
Clear the cache and clear the cached blade files:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
You can also check if opcache enabled, in that case you need to clear your opcache cache.
Like Can Gelis mentionned in a comment. For me the solution was to reload PHP FPM
service php7.2-fpm reload
Alternatively if other suggested methods did not work, you can rename your files to different names. Refresh their corresponding web pages to start using new file name reference. Then you can rename the files back to your preferred names after the new pages to reflect their changes.
I have cleared all cashs and uploaded folders but didnt see changes.
Thus, if you have placed the project on a public hosting and don't have access to console then try to set deployment via your IDE (mine is phpstorm, e.g.)and set it to autoload mode. Then you'll get it working by changing something in the problem blade and by pressing cntrl+s(save) shortcut.
clear cache didn't work for me, but I just edited the file and saved it again, and it works!
None of these solutions have resolved this issue for me. Tried all php artisan options and the php code is not updating.
Only solution i've found is restarting the docker container that the code is running inside.
In case you try everything and nothing works. I recommend that you simply create a view under another name and the problem will be fixed
Example:
welcome.blade.php
change to
newview.blade.php
copy and paste code to new view
In controller just point to new view:
return view('newview');

Laravel Blade views not showing the changes made to them

System Details : Using WAMP2.5 in Windows 64 bit MYSQL:5.6.17 PHP:5.5.12 Apache :2.4.9I installed laravel via composer installation . It was all fine since recently all my views stopped showing any changes made to them . This is happening to views which use Blade template only.
I have created the blade files correctly and named them with filename.blade.php.
My view File Structure -
views
-layouts
defaults.blade.php
show.blade.php
login.blade.php
defaults.blade.php
<!DOCTYPE html>
<html>
<head></head>
<body>
<div>
<nav></nav>
#yield('content')
</div>
#yield('footerscripts')
</body>
</html>
show.blade.php
#extends('layouts.defaults')
#section('content')
--- SOME CONTENT ---
#stop
#section('footerscripts')
--- js scripts ---
#stop
The same format was working perfectly but suddenly started acting strangely.Even after refreshing many times the view doesn't change,Once i tried deleting everything inside the view page still it showed up in the browser.
There are similar question but many didn't have accepted answer and the one with some ratings didn't worked for me . I also tried re-installing fresh new WAMP copy but no Help.It only works if i change its name but if i change it back to the original one it again starts showing the old version of it.
Only happens with blade templating.
If you use PhpStorm:
open menu File → Settings
go to Deployment → Options section
then uncheck Preserve files timestamps option
I'm not sure of the specifics, but this is related to how filemtime() is implemented in windows (possibly related bug here).
Illuminate\View\Compilers\BladeCompiler (well, it's parent class, Compiler) checks to see if a file has changed since last compilation by checking it's mtime, through Illuminate\Filesystem\Filesystem which calls calls filemtime() (see L179-188). Evidently this is failing to report properly on your system.
First, ensure that the app/storage/views directory has read, write and delete permissions. If this doesn't help, the simplest solution would be to clear the app/storage/views/ directory whenever making a change.
I had this same issue , reason was I am doing uploads remote, but the time on my computer was different than what that was on my server
I got very easy solution, I was having same project in two folders, I was editing one and php artisan was running on other, when get to that project where php server was running in it and made changes it worked.
In your cmd(command prompt) or terminal type and press enter...
php artisan view:clear
For this to work, your terminal should be pointed to your root directory of your laravel installation/folder
Or delete files in the folder
storage/framework/views
In order to avoid the parsing of Blade files on each reload, Laravel is designed to caches views after Blade is parsed, to avoid re-parsing the blades on each reload.
Or make sure you are editing the right view, in the right Laravel Installation.
Run the command npm run production or npm run dev
It solved my problem:
I had the same issue except my controller methods also did not want to reflect changes along with views. I tried the following commands:
user:/var/www/html/website$ php artisan cache:clear
Application cache cleared!
user:/var/www/html/website$ php artisan config:clear
Configuration cache cleared!
user:/var/www/html/website$ php artisan route:clear
Route cache cleared!
user:/var/www/html/website$ php artisan view:clear
Compiled views cleared!
Nothing changed.
I echoed an incorrect variable from a controller method. Nada!
I changed the app.css?v=2 file version. In the silence that followed after... there was no difference.
I cleared my browser cache.
I manually deleted:
bootstrap/cache/config.php
framework/sessions/*
framework/views/*
No changes and finally I ran the command npm run production and bingo! Try it, it will save you 2 and a half hours of frustration and radical thoughts.
Laravel/framework v5.6
Clear cache and restart php-fpm. That solved it for me.

Resources