Annoying text every page in Laravel web app - laravel

This is driving me crazy, but for some reason I have the letters "vd" before all rendered content on each page of my site in my Laravel app. Basically the letters "vd" appear at the top of every page (website, not the actual code) before the navbar or any other content. They also appear when ever I run a php artisan command. For example
C:\Users\Thomas\Git\Webapp> php artisan view:clear
vdCompiled views cleared!
-- OR --
C:\Users\Thomas\Git\Webapp> php artisan serve
vdLaravel development server started: <http://127.0.0.1:8000>
I've checked all my views and can't find the letters "vd" anywhere, but figure it must be coming from something being processed before the view because I get it running simple "php artisan" commands.
I have also tried running the webapp from "C:\wamp\www\Webapp" using WAMP and still get the "vd" text.

Probably you have the "vd" string at the top of a bootstrap file, (config, service provider, route) before the php open tag!

Try a global search in your project and find if you have vd anywhere in your whole project. may be somewhere it can be found. try to search in index.php and bootstrap.php, server.php

Related

My site doesnt output laravel page...What shoud i do?

On browser, typing localhost/spa1/public or spa1.test doesn't output the laravel. I've been stuck and cant even proceed to starting my project because of this. I really need help!!
The output supposedly :
enter image description here
The app key is :
APP_KEY=base64:lEpLqsi9GOqaz6eyu5VaTft0UOfj7u+A4LAie6LEJoc=
I'm using xampp on windows
My problem is y it doesnt output the Laravel page like the Google one?
In your terminal, you should start the server.
php artisan serve
This will create a home URL like localhost:8000 and read index.php file in the public folder.
BTW, the image you share is Laravel's default home page. If you look at welcome.balde.php file, you can see the same content there. So your app is running. But it's not a good idea to display your app without artisan serve.
Your code is fine, and this is how the home page looks like in Laravel 8. Because the home page you're talking about was in Laravel 7 & below. And from Laravel 8 onwards, the default home page of Laravel 8 is updated and looks like the one you're getting right now.

What is the most direct way to push a site update to Laravel?

I've SSH into the server and into the Laravel folder. I updated one of the html footer files but the changes aren't reflected on the website. I feel like I probably need to recompile something.
I tried deleting and re-creating the .env file (I backed it up first).
I've tried running the following commands:
php artisan clear-compiled
php artisan optimize
php artisan cache:clear
The only way I can seem to update the site is by updating the main.min.js file, located at /laravel/public/assets/js/main.min.js which is a terrible way to update the site.
How do I force Laravel to recreate this file or recompile the site based on changes I made to html template files within the site?
What am I missing here? I don't have any Laravel experience and am trying to update this site for a client.
edit:
I think I need to clarify a bit more...
The site appears to be rendered from this file: /public/assets/js/main.min.js
Most of the site's homepage, for example, is located in this js file. But the file is minified and therefore unwieldy to edit directly.
I am assuming (and I could be completely wrong here) that the file is generated from the html files located in the Laravel folder. To support this notion, I have found html files in other directories that correspond to the html located in the main.min.js file.
My assumption is that the previous developer would update the html files and then run something to compile the site into javascript files. But maybe this has nothing to do with Laravel, per se, and more to do with some frontend framework?
Try clearing the cached views...
php artisan view:clear
Laravel assets reside in
resources/assets/js
of your root directory you can have look their
if your file main.js is build using laravel mix have a on webpack.mix.js which compiles all your files you can get idea from that. make sure to run
npm run prod
if you change any file
Hope this helps?

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');

Set Laravel Application Urls

Fairly new to Laravel here and I'm struggling to understand how to make Laravel 5.2 aware of where it resides. Here's the issue:
I set up auth using php artisan make:auth, and can now see the lovely landing page, as well as login and register links in the menu. The problem is that these links don't go to the right place. They point to /login and /register in the code respectively, which translates into http://localhost/login or http://localhost/register. But since I'm not on a production site yet and am developing locally, my website resides at http://localhost/projectname/public.
I've gone into config/app.php and tried various values for the URL parameter, but these have no effect.
What can I do to get these links to reflect the full site URL, without manually entering it each time?
you can run the development server in laravel using this command
php artisan serve
Did you try that?
Use laravel url function:
{{ url().'/login' }}

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