Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
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.
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.
–
You have to consume a function of the controller instead of using the whole controller class for one request. so laravel doesn't know which of your function to use.
Try using PortfolioController@index
. or Route::resource('yourroute','PortfolioController');
–