Laravel 5 view not found - php

I'm having the weirdest error in Laravel 5, and I haven't had this happen in any of my other projects.
Problem
I receive the following error when I try to hit my app
No such file or directory (View: /home/vagrant/Code/resources/views/layout/master.blade.php) (View: /home/vagrant/Code/resources/views/layout/master.blade.php)
However, in my directory structure
And in my blade template
#extends('layout.master')
#section('content')
jfoewifjewo[ij
#endsection
In my controller
public function index()
{
return view('home');
}
Anyone else hit this issue? I've never encountered it before. Yes storage has read/write on both local and homestead.
UPDATE: I'm on Laravel 5.0.13

This issue lies with using Laravel Elixir with homestead. I went back to MAMP to see if I got the same error and what it told me was that I was missing the rev-manifest.json file in public/build. After some digging, I found out that if you don't apply the "versions" function to the elixir function in your gulpfile, the build folder won't be generated and calls to the "elixir" function in your blade templates will fail. This appears to bubble up as an error in finding the view, when it's actually an issue finding a view dependency.
Use gulp to build your sass or less files for sure, but for the time being stick with just URL::asset() to get your javascript and css file paths generated until all the kinks with elixir are worked out.

This is a well know version issue Laravel 5.0.1 (#Zarathuztra version) Here is some comments about the issue: https://laracasts.com/discuss/channels/general-discussion/laravel-5-error-out-of-the-box-with-update-route-throws-an-error
Search for "PratyushPundir" and from them you will see some people having the same issue
Updating Laravel should fix it.

I fix it by add the version. Because after add the version in gulp, it will generate rev-mainfest.json.
original gulp in homestead
elixir(function(mix) {
mix.sass('app.scss');
});
I change to
elixir(function(mix) {
mix.sass('app.scss')
.version(["public/css/app.css"]);
});
And it works.

Related

View [layouts.account] not found. Whats the issue? [AsgardCms]

I'm having an issue of AsgardCms which is made with Laravel. I created a Theme on Asgard and then it goes well. But after sometime if I logout from the backend and want to log in again or after my system reboot, It throws an error:
View [layouts.account] not found. (View:
\Modules\User\Resources\views\public\login.blade.php)
If I setup new project again, It works again and then after that same error throws.
I am newbie of Laravel aswell as Asguard. I searched the problem but really didn't find anything with my error.
PS: I cleared the artisan cache, view and publish theme also composer update. But really didn't help. What I'm missing?
Check for [layouts.account] layout with exact name account i think in your view the layout you called doesn't exist or misspelled you can share you code for more details.
Finally I found the answer, I did created a new theme, And account.blade.php is missing in the /themes/your-theme/views/layouts folder.
So, from the default theme(Flatly), I copied the account.blade.php on /themes/your-theme/views/layouts folder and it fixed my issue.
Thanks everyone!

Assets wont load after renaming public folder in Laravel

I'm using laravel version 5.3
I renamed my public folder to public_html by add following lines to my
AppServiceProvider
I update/renamed following code in register method.
public function register()
{
$this->app->bind('path.public', function() {
return realpath(base_path().'/../public_html');
});
}
After that any of my assets wont load i faced 404 error for all of them. what should i do now?
I strongly suggest you do not use a hosting webspace for Laravel.
VPS is cheap as heck these days, get a VPS and use Laravel Forge if you don't want to manually install the environments.
Use git to deploy your code on to the server.
Even if you solved this very problem with symlink(I don't think you have the permission), you will still encounter other problems because you won't have the permission to install composer dependencies.
By the way, what Dennis suggested would not matter I believe, it still points to the same destination.
remove the first / of /../public_html

Laravel 5.6 Reoccuring Error

I have an error that occurs no matter what the actual error is within Laravel 5.6 It just keeps saying Could not find resource 'views/layouts.html.php' in any resource paths.(searched: /var/www/{domain}/vendor/filp/whoops/src/Whoops/Handler/../Resources) for everything that causes an error and doesn't display the full debug page that Laravel usually displays. I'm not sure what caused this or what I could do to fix it besides reinstalling Laravel, which I'd highly prefer not to do. Does anybody have any ideas what file I might be missing or what might be causing this?
Image of full error: https://i.imgur.com/5dFhlYg.png
why you use layout.html.php. Laravel has a template engine blade. you can use layout.blade.php
You Need to use views.layout. example:
return view('views.layout');
But note there are views is a folder name. if you create a folder under views folder then you can call views folder. Laravel default views folder is views don't need to call on return path.

Route/View related issue in Laravel

I've encountered a problem while creating simple apps with Laravel on IIS.
When I create a new Laravel application I can see the Laravel welcome page just fine.
If I create another view in the same folder as the welcome.blade.php (test.blade.php for example), and set up the route for that in routes/web.php I can't navigate to that page in browser. EDIT: When I attempt this I get a 404.
My web.php is as follows:
<?php
Route::get('/', function (){
return view('welcome');
});
Route::get('/test', function (){
return view('test');
});
At first I thought that perhaps the project was not reading web.php, but when I run php artisan route:list the test route is listed.
I thought perhaps that my view didn't work, so I renamed it as welcome.blade.php and that loaded up fine. I just seem to be unable to add a route to any view or anonymous function that isn't mapped to welcome.blade.php
I tried adding a static route.php file into the app directory with the same code, but that made no difference to the result.
I'm sure I must be missing something basic, but I can't seem to put my finger on where I've gone wrong. Would massively appreciate any help you might be able to offer. Thank you.
Right I worked out where I went wrong. I hadn't run artisan serve. Very simple.
If you're having this problem, try navigating to your application root in cmd and then try
php artisan serve
Then navigate to your page using that information.
Thank you to everyone who posted, massively appreciated.
You need to install Url Rewrite in your terminal. Then import the .htaccess file located in your project/public folder.
To install Url Rewrite, you need to install Web Platform Installer (WPI). Once installed, open WPI then search for the keyword "Url Rewrite", then install the first item in the result. Once the download is finished, Url Rewrite will be available in your IIS Manager
I think IIS server maybe blocks test url.
IIS server has such features.
Before time, I remember that I used IIS blacklist url feature.
You may check IIS url block feature.

Routes file lost - Laravel

Just started out working with Laravel and Homestead.
I followed below guide for that :
https://www.youtube.com/watch?v=S3kaQDFJiis
and did everything exactly the same, but when I open my project Laravel/app/Http there's no routes.php file just kernel.php.
What could possibly cause this? How to fix this? Maybe I messed up something during installation? I did try to re-install everything, but I faced same problem.
If you're using the latest version of Laravel, the routes can now be found in
Laravel/routes/
This folder contains 3 different files each used for their respective consumption methods api web console
I think you are using laravel latest version which is "5.3.*".
From laravel 5.3 routes has found a new home which is under
projectname/routes/.
routes directory has 3 php file
api.php
console.php
web.php
You can check your Laravel version form projectname/composer.json under require as "laravel/framework": "5.3."*
Reference:
Laravel 5.3
Keep note that from Laravel 5.3 the routes.php file has been removed and moved to
laravel_project_folder/routes/web.php
laravel_project_folder/routes/api.php
See Laravel 5.3 Routing Docs & Laravel Upgrade Guide Section
Hope this helps!
You will find it in
1)routes/web.php
You can also read the use of api.php and console.php files as they are also used in routing

Categories