Anoop T U
Anoop T U

Reputation: 135

Object not found error - When creating new pages in Laravel

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

Answers (2)

Alexey Mezenin
Alexey Mezenin

Reputation: 163798

Set your home directory to the public to make things work.

Upvotes: 1

darkvirus24
darkvirus24

Reputation: 119

Exchange the route. like this:
Route::get('contact','WelcomeController@contact');
Route::get('/','WelcomeController@index');

Upvotes: 0

Related Questions