Zaczynam naukę z frameworkiem php Laravel w wersji 5.0. Domyślna strona głowna wyświetla się normalnie, ale kiedy tworzę view to dostaję tylko 404. To co zrobiłem to: dopisałem linijkę do pliku routes.php:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::get('form', 'HomeController@form'); //<- to dopisane
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]);
Dopisałem funkcję do pliku HomeController.php:
<?php namespace App\Http\Controllers;
class HomeController extends Controller {
/*
|--------------------------------------------------------------------------
| Home Controller
|--------------------------------------------------------------------------
|
| This controller renders your application's "dashboard" for users that
| are authenticated. Of course, you are free to change or remove the
| controller as you wish. It is just here to get your app started!
|
*/
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
return view('home');
}
//dopisana funkcja
public function form()
{
return view('form');
}
}
I stworzyłem plik form.blade.php w folderze views (resources/).
Wpisując w przeglądarkce localhost/sciezka/form dostaję tylko błąd 404
Not Found
The requested URL /blog/public/form was not found on this server.
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80
To samo jest po wpisaniu localhost/sciezka/home więc pewnie coś nie tak z konfiguracją, ale nigdzie nie grzebałem. Pod localhost/sciezka jest normalnie działająca strona początkowa. Byłbym wdzięczny za pomoc w rozwiązaniu zagadki.
Zrobiłem to co tutaj: http://stackoverflow.com/a/14490649 (zaznaczenie rewrite_module) i teraz nie ma 404, ale przenosi do jakiejś strony z formularzem logowania