Laravel Homestead Routing : InvalidArgumentException in compiled.php : View [****] not found - php

After getting my Laravel Homestead up and running, I'm facing a new problem.
Even after some googling, I can't find a solution for setting up routes in Laravel Homestead.
Here is my routes.php (I created files like in the comments) :
<?php
// ===============================================
// STATIC PAGES ==================================
// ===============================================
// show a static view for the home page (app/views/home.blade.php)
Route::get('/', function()
{
return View::make('home');
});
// about page (app/views/about.blade.php)
Route::get('about', function()
{
return View::make('about');
});
// work page (app/views/work.blade.php)
Route::get('work', array('as' => 'work', function()
{
return View::make('work');
}));
Route::get('users', function()
{
return View::make('users');
});
Thank you in advance for any piece of advice.

In Laravel5 the views are located in
resources/views
and not in app/views
Place all your views to resources/views and it should work.
You get the welcome page because it is shipped by default in Laravel.

Related

The get in laravel doesn't find any page

I am very a beginner in Laravel
I launch my laravel project on localhost
<http://localhost/ecommerce/public/>
Route::get('/', function () {
return view('welcome');
});
this give me the welcome page
But I want to add about page but it always say "404 Not found"
and that's my code:
Route::get('/about', function () {
return view('about');
});
I made a file in views and called it "about.blade.php"
when I type to view about like this :
Route::get('/', function () {
return view('about');
});
and remove the welcome get, it works and give the about page
but when I put it in get "/about" it always doesn't work, even if I just type "string"
why it can't recognize get "/about"?
You should run the project with php artisan serve in terminal or in the server you have to change document root and remove the public in URL
the reason is the extra public in your url

PHP Laravel route after installation

I installed new laravel project("Starter") and want to view the 'welcome' page by putting this URL.
http://localhost/starter/
The page ran fine when the route is the following.
Route::get('/', function () {
return view('welcome');
});
However, when I write any thing after the (/)...
Route::get('/test', function () {
return view('welcome');
});
And view it by URL:
http://localhost/starter/test
The page doesn't work and shows...
404
Not Found
Any ideas?
(s) in word (starter) in the URL, shoud be UpperCase (Starter) as the name of Laravel project

laravel 8 does not set homepage like in 7x version

I would like to set the home page of laravel 8 as that of laravel 7x.
to do this I wrote the following route:
Route::view('/', 'welcome', [PollController::class, 'element']);
I just keep seeing the following page:
Route::get('/', [PollController::class, 'element'], function () {
return view('welcome');
});
I renamed the file resources/views/welcome.blade.php in resources/views/welcome.blade.php and it worked

Change the route in Aimeos Laravel

I am using Aimeos e-commerce on a Laravel site, I want to change the store route to /shop but I get an the browser doesn't open a page I do it as follows
Route::get('/shop', function () {
return redirect('shop');
})->name('shop');
but when I make on "/" main page it displays perfectly. How to change its route?
Use this in your route/web.php file:
Route::get('/', function () {
return redirect('shop');
});
See https://github.com/aimeos/aimeos/blob/master/routes/web.php

Routing between Angular & Laravel

I am trying to make a simple App in Angular , integration with Laravel 5 and facing issues while routing the application views.
Routes.php looks like as below:
<?php
Route::get('/', function () {
return view('index');
});
in Routes.php, i am handling only first time when application loads.
But after that i want to handle all routing by Angular. So, i did like this:
app.js file
var membershipModule = angular.module('membershipModule', ['ngMaterial','ngRoute']);
membershipModule.config(function($routeProvider, $locationProvider, $mdThemingProvider){
$mdThemingProvider.theme('default').primaryPalette().accentPalette('blue-grey');
$routeProvider
.when('/login', {
controller: 'LoginController',
templateUrl: 'views/login.html'
})
.when('/register', {
controller: 'RegisterController',
templateUrl: 'views/register.html'
})
.otherwise({redirectTo: "/"});
$locationProvider.hashPrefix('');
});
But when i access http://localhost:8000/#/login then it throws error that views/login.html is not found.
I tried making login.html in Laravel Default Folder as below screen
Also Tried making views/login.html in root dir as below
but none of it is working
You can put this files inside the public directory. As you can see in https://laravel.com/docs/5.3/structure#the-public-directory

Categories