I was testing out while learning Laravel 5, creating a new controller, but I do get a strange error, when it is supposed to work fine. Here it is:
I created a new folder Pages in the app/Http/Controllers/ directory, and added the controller ContactController into it:
app/Http/Controllers/ContactController.php
<?php
namespace App\Http\Controllers\Pages;
use App\Http\Controllers\Controller;
class ContactController extends Controller {
public function getIndex() {
return 'This is the Contact page.';
}
}
and then I created a route in the routes/web file:
routes/web.php
Route::controller('contact', 'Pages\ContactController');
Strangely, when I access the /contact URL -> http://laravel.devpeaks.com/public/contact, I get:
BadMethodCallException in compiled.php line 6271:
Method controller does not exist.