Reputation: 135
I am new in Laravel. I am trying to create a new page named as "contact". But i am getting a Object not found error when i am trying to access the contact page
URL: project-name/contact
please help me
---routes file
<?php
Route::get('/','WelcomeController@index');
Route::get('contact','WelcomeController@contact');
Route::group(['middleware' => ['web']], function () {
//
});
--- Welcome controller
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class WelcomeController extends Controller
{
public function index(){
return view('welcome');
}
public function contact(){
return 'Contact page goes here...';
}
}
Upvotes: 3
Views: 366
Reputation: 163798
Set your home directory to the public
to make things work.
Upvotes: 1
Reputation: 119
Exchange the route. like this:
Route::get('contact','WelcomeController@contact');
Route::get('/','WelcomeController@index');
Upvotes: 0