Reputation: 801
i'm new to laravel. i had this problem when try to play around with route and controller. i have this controller
class DashboardController extends BaseController {
public function actionIndex()
{
$photos = Auth::user()->photos()->orderBy('created_at', 'desc')->orderBy('id', 'desc')->get();
return View::make('dashboard.index', array('photos' => $photos));
}
public function action_insert_test_data()
{
$logged_in_user = Auth::user();
for( $x = 0; $x < 10; $x++ ) {
$email = rand().'@gmail.com';
$user = new User();
$user->email = $email;
$user->password = Hash::make($email);
$user->save();
$logged_in_user->followers()->attach($user->id);
if( $x >= 5 ) {
$logged_in_user->following()->attach($user->id);
}
}
}
and i try to route all action in this controller to dashboard page with
Route::controller('dashboard', 'DashboardController');
but i didn't work, instead i got an error message like this
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
what should i do? where did i go wrong? i'm using laravel 4.1 thanks for your attention
Upvotes: 2
Views: 2075
Reputation: 1090
The methods in your class should be named getIndex
and getInsertTestData
.
See Laravel Implicit Controllers
Upvotes: 1