Cath
Cath

Reputation: 43

'NotFoundHttpException' in Laravel Project

I tried to upload my Laravel project using FTP, I did a composer update and changed server's PHP version to 7. But I'm getting a 'NotFoundHttpException' error. Can someone help me?Im just learning Laravel and deploying a project.I used hostinger. Thanks in advance.

Sorry, the page you are looking for could not be found.

(1/1) NotFoundHttpException in RouteCollection.php (line 179)

at RouteCollection->match(object(Request)) in Router.php (line 548)

at Router->findRoute(object(Request)) in Router.php (line 527)

at Router->dispatchToRoute(object(Request)) in Router.php (line 513)

at Router->dispatch(object(Request)) in Kernel.php (line 176)

at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php (line 30)

at Pipeline->Illuminate\Routing{closure}(object(Request)) in TransformsRequest.php (line 30)

at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php (line 148)

at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53)

at Pipeline->Illuminate\Routing{closure}(object(Request)) in TransformsRequest.php (line 30)

at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php (line 148)

at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53)

at Pipeline->Illuminate\Routing{closure}(object(Request)) in ValidatePostSize.php (line 27)

at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php (line 148)

at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53)

at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php (line 46)

at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php (line 148)

at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php (line 53)

at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php (line 102)

at Pipeline->then(object(Closure)) in Kernel.php (line 151)

at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php (line 116)

at Kernel->handle(object(Request)) in index.php (line 53)

<?php

Route::get('index', function () {
    return view('index.index');
});

Route::get('signup', function () {
    return view('auth.signup');
});

Route::get('choose-signup', 'EmployerLoginController@create');
Route::post('choose-signup', 'EmployerLoginController@store');

Route::get('register-emp', function(){
    return view('Auth.register-emp');
});

Route::post('register-emp', 'RegEmpController@store');

// --- 

Route::get('home', 'HomeController@index');
Auth::routes(); // --- 

// employer
Route::get('logs', 'Auth\EmployerLoginController@showLoginForm');
Route::post('logs', 'Auth\EmployerLoginController@login')->name('logss');


Route::get('employer', 'EmployerController@index')->name('emp');
// employer

// *******W O R K E X P E R I E N C E**************

Route::get('profile', 'WorkExperienceController@index')->middleware('auth');
Route::post('profile/add','WorkExperienceController@store');
Route::get('resume', 'WorkExperienceController@create')->middleware('auth');
Route::post('resume/{id}', 'WorkExperienceController@update');
Route::get('resume/{id}', 'WorkExperienceController@destroy');

// **********E D U C A T I O N***********

Route::post('profile/added','AddEducationController@store')->middleware('auth');
Route::post('profile/{id}', 'AddEducationController@update');
Route::get('profile/{id}', 'AddEducationController@destroy');

//*********S K I L L S******************
Route::post('skill/added','AddSkillsController@store')->middleware('auth');
Route::post('skill/{id}','AddSkillsController@update');
Route::get('skill/{id}', 'AddSkillsController@destroy');


//********* S E M I N A R S******************
Route::post('profileaddsem','AddSeminarController@store')->middleware('auth');
Route::post('seminar/{id}','AddSeminarController@update');
Route::get('seminar/{id}', 'AddSeminarController@destroy');

//*********C O N T A C T I N F O******************


Route::get('jobseeker-signup', 'ContactInfocontroller@create');
Route::post('jobseeker-signup', 'ContactInfocontroller@store');
Route::post('contact/{id}','ContactInfocontroller@update');

Route::get('choose-signup2', 'JobseekerLoginController@index');
Route::post('choose-signup2', 'JobseekerLoginController@store');



// Route::get('/contact-info', function () {
//     return view('jobseeker-signup-partials.contact-info');
// });

// *****************I M A G E ***********************
Route::post('imgupdate','HomeController@update_avatar');

// ***************P O S T A J O B*************************

Route::get('jobsearch', 'PostJobController@index');
Route::post('jobsearch', 'PostJobController@index');

// ***************e d i t p o s t e d j o b************************

Route::post('posted/{id}', 'PostJobController@editJob');
Route::get('posted/{id}', 'PostJobController@destroy');


// ************J O B  P O S T******************
Route::get('jobpost/{id}','PostJobController@show');
// ****Click Apply**********
Route::post('jobpost','ApplicationController@store');
// ****Click Save**********
Route::post('save','ApplicationController@saveJob');
// ***********delete saved jobs*******************
Route::post('unsave/{id}','ApplicationController@destroy');

Route::get('applicants','PostJobController@applicants');

Route::post('pdf','WorkExperienceController@upload');


// ****************************************
Route::get('sendemail', function() {

    $data = array (
        'name' => 'Hello Email!',       

        );

        Mail::send('emails.welcome', $data, function($message){

        $message->from('[email protected]','Hello');
        $message->to('[email protected]')->subject('Hello');
        });

    return "Your email has been successfully sent";
});




Route::get('application', function(){
    return view('index.application');
});
Route::get('messages', function(){
    return view('index.messages');
});


// ***********E M P L O Y E R***********************

Route::get('employer-signup', 'EmployerSignupController@create');
Route::post('employer-signup', 'EmployerSignupController@store');


// Route::get('company-profile', 'PostJobController@create');
Route::post('employer/post', 'PostJobController@store');



// Route::prefix('employer')->group(function(){


//     Route::get('/login', 'Auth\EmployerLoginController@showLoginForm')->name('employer.login');
//     Route::post('/login', 'Auth\EmployerLoginController@login')->name('employer.login.submit');
//     Route::get('/', 'EmployerController@index')->name('company-profile');
// });



// Route::get('/login', function () {
//     return view('auth.login');
// });

// Route::get('/jobseeker-signup', function () {
//     return view('auth.jobseeker-signup');
// });
// Route::get('/company-profile', function(){
//     return view('index.company-profile');
// });


// Route::get('post', 'PostJobController@index');

Upvotes: 3

Views: 2913

Answers (2)

K&#233;vin Bibollet
K&#233;vin Bibollet

Reputation: 3623

EDIT: As mbozwood said in the comments: two same URLs can exists with two different methods.


I don't know if you can really create two routes with same URL but different method (GET and POST), like these ones:

Route::get('choose-signup', 'EmployerLoginController@create');
Route::post('choose-signup', 'EmployerLoginController@store');

Instead, use

Route::match(['get', 'post'], 'choose-signup', 'EmployerLoginController@signup');

And in your controller method :

public function signup(Request $request)
{
    if ($request->isMethod('post'))
    { return redirect()->action('EmployerLoginController@store', ['request' => $request]); }
    else
    { return redirect()->action('EmployerLoginController@create'); }
}

It mays not to be the problem, but it is quiet weird.

Upvotes: 0

mbozwood
mbozwood

Reputation: 1402

Based on your comment: 'Hi, here is the url of my project....', The route you are trying to access is '/'. By a quick glance of your routes file, this doesn't exist.

I tried http://cathumali.890m.com/index and this pointed me to what looked like a front page. If this is the intended page, I would suggest adding another route that either points to the same controller or fixing the routes to all point to index.

Route::get('/', function () {
    return view('index.index');
});

Upvotes: 3

Related Questions