laravelhelpme's avatar

After Copying a Laravel project Blade views not reflecting changes

Hi I copied a whole Laravel project folder to a new one: old_project to new_project (as I did a lot of times to keep versioning). But now after that any changes to new project Laravel Blade template files are not update/showed.

I tried to delete cache and also manually to delete storage/framework/views/* files but not matter what i have done. I continue to see old files and no updated files. Why?

Thank you

0 likes
20 replies
Tray2's avatar

First of all get some proper version control like git which is free.

https://git-scm.com/

You can try running php artisan view:clear to clear all cached views.

Dalma's avatar

Perhaps your domain name/ server instance is not pointing to the code base that you think it is?

laravelhelpme's avatar

I'm testing all stuff with local server: php artisan serve --host=127.0.0.1 --port=8080

laravelhelpme's avatar

Any advice? I read it should be a problem of different timestamp. But I don't found a solution...

Snapey's avatar

If you deleted all the cached view files, how can it show old content? Perhaps you did not update the project at all.

Yes there can be a time issue if the view you create has an older timestamp than the cached file - but you say that you deleted the cache?

nkarlis's avatar

Perhaps you have another process of php artisan serve left running on port 8080 and your new process started on another port. So you are seeing old files served perhaps from a previous project.

siangboon's avatar

Rename one of the file name and try to access it, if you did not see the 404, most likely something wrong at your setup, or add a new route to a test blade page. By the way, what had you change that not update? CSS style?

munazzil's avatar

Use below commands and check,

  npm run dev

else

  npm run watch
1 like
laravelhelpme's avatar

I continue to be unable to modify files. That is what I do:

  1. cp -r old-laravel-project new-laravel-project
  2. cd ./new-laravel-project
  3. php artisan storage:link
  4. php artisan view:clear
  5. nano ./new-laravel-project/views/test.blade.php (I did some mods)
  6. php artisan serve --host=127.0.0.1 --port=8080

My new mods are not showed and I continue to see old data. When I did point #4 I got message views were cleared but there were still a lot o cached views in "/storage/framework/views" so I deleted them by myself.

And if I delete my view "test.blade.php" I continue to see page instead 404 error.

Any advice? I read there could be some problem with PHP's opcache module. Is that the case?

Thank you

Snapey's avatar

Do you have another web server running (pointing at the old code)

if you don't run php artisan serve do you get any content in your browser?

1 like
laravelhelpme's avatar

Snapey I have not an other web server. I'm just using php artisan server one as I always done during development.

jlrdw's avatar

Did you ever composer dumpautoload

May need to delete the composer lock file, delete vendor folder and do another composer update, or composer install.

1 like
siangboon's avatar

double check your route whether you are accessing the right url to a right view?

laravelhelpme's avatar

I tried also as suggested:

  • composer dumpautoload
  • rm -f composer.lock
  • rm -fr vendor
  • composer update

But no changes. I continue to see old files content instead new one...

Snapey's avatar

Comment out the route you are testing then refresh the page. Do you get content or 404

siangboon's avatar

show the codes and screenshots... all are just purely your words... it's hard to believe as it's very odd the chance to have this happen is almost 0.

suggest you that screenshot (better don't crop, fullscreen shot of what you running) the actual step by step what you did and what actually happened will help folks to understand your issue more clearly....

shuinvy's avatar

Hello, I know its too late, but I faced same problem, too, and I found the problem just as your operation, and after I run some php artisan command, I found I cannot reach the folder of views(permission denial) so I changed my views owner by Linux commad: sudo chown youraccount:youraccount, and youraccount means your system login username( Linux, Ubuntu, CentOS username, etc). and after changed the permission of the folder, I can delete files of views by 'php artisan view:clear'. By the way, I found I cannot run my web page after that, so I changed my views permission to 0777( I have tested 0755, but it is not working). Let me sum up: Change the owner( to your system username) and permission(0777) of views folder. Hope it can help others who faced same problem, good luck!

Please or to participate in this conversation.