Reputation: 85
I am new to Laravel , I am getting 404 not found error when returning view to salary report from my controller. The below mentioned is my function which returns my simple view to salary report.
public function getSalaryReport()
{
return view('Company.salaryReport');
}
the routes.php file ahs route to company controller.
Route::group(['middleware' => 'auth.company'], function () {
Route::get('company/notice-board/create', 'CompanyController@getNoticeBoardCreate');
Route::get('company/notice-board/{id}/edit', 'CompanyController@getNoticeBoardEdit');
Route::get('company/designation/{id}/edit', 'CompanyController@getDesignationEdit');
Route::get('company/all-user/{id}/force', 'CompanyController@getForce');
Route::post('company/all-user/{id}/force', 'CompanyController@postForce');
Route::controller('company', 'CompanyController')
this is my view which i am trying to display from my controller.
@extends('Company.CompanyLayout')
@section('content')
<div>
<ul class="breadcrumb">
<li>
<a href="{!! URL::to('company') !!}">Home</a> <span class="divider">/</span>
</li>
<li>
<a href='{!! URL::to("company/report-summery") !!}'>Summery Report</a>
</li>
</ul>
</div>
@endsection
where i am going wrong and what should be done to make my view visible. Thanks to all in advance.
Upvotes: 1
Views: 2578
Reputation: 2216
404 not found
is an error because you don't have any routes for the given url. And I didn't find any routes in your example for the function getSalaryReport()
if you want to call this method, at least add this to your routes:
Route::get('company/report-summery', 'CompanyController@getSalaryReport');
Upvotes: 1
Reputation: 1754
Route::controller
is depricated in the latest versions of Laravel, try not to use it anymore.
You can use Route::resource
or create a specific route for your salary report like this:
Route::get('company/salary-report', 'CompanyController@getSalaryReport');
Also make sure that you have resources\views\Company\salaryReport.blade.php
as your view.
Upvotes: 1