Why am I getting this error. I created a PortfolioController. Then I made a route using this
Route::get('portfolio','PortfolioController');
So in my controller page I made this.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class PortfolioController extends Controller
{
//This only gets exectued when we request /portfolio/Paintings using GET
public function getPaintings()
{
return 'This RESTful controller is working!';
}
}
I get this error when typing in localhost/portfolio/paintings
From the look of your code, it looks like you're trying to setup an implicit controller route. You're close, but your route definition is a little off. You need to use controller
instead of get
:
Route::controller('portfolio','PortfolioController');
https://laravel.com/docs/5.3/upgrade#upgrade-5.3.0
The following features are deprecated in 5.2 and will be removed in the 5.3 release in June 2016:
- Implicit controller routes using
Route::controller
have been deprecated. Please use explicit route registration in your routes file. This will likely be extracted into a package.
You must declare each endpoint now.
try this
Route::get('portfolio','PortfolioController@getPaintings')
I got a similar error when there was a mistake in he file of web.php.
A correct route would like this Route::get('portfolio','YourController@yourMethod');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With