Support the ongoing development of Laravel.io →
posted 11 years ago
Views

Hi! I am new to Laravel. I am trying to write my first application in Laravel.

I faced a problem with Route::resource

My controller is:

<?php

class LanguageController extends BaseController {


	function index() {
	    $langs = Language::all();

	    return View::make('admin.language.index')->with('langs', $langs);
	  } 

	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function create()
	{
		//
	}

	/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
	public function store()
	{
		//
	}

	/**
	 * Display the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function show($id)
	{
		//
	}

	/**
	 * Show the form for editing the specified resource.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function edit($id)
	{
		$lang = Language::find($id);
		return View::make('admin.language.edit')->with('lang', $lang);				
	}

	/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function update($id)
	{
		//
	}

	/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}
}

And i have created a route rule:

Route::resource('language', 'LanguageController');

but when I visit mycoolapp/admin/language the error appears

Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

Can someone tell me what is wrong?

Last updated 2 years ago.
0
Route::resource('admin/language', 'LanguageController');
Last updated 2 years ago.
0

Thanks man I missed that!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

altercode altercode Joined 8 Mar 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.