2014-06-18 2 views
3

Laravel이있는 뷰에서 특정 ID에 연결하는 방법은 무엇입니까?Laravel로 페이지의 특정 앵커에 대한 링크

내 컨트롤러 :

public function services() { 
return View::make('services.custom_paint', array('pageTitle' => 'Custom Paint'))->with('default_title', $this->default_title); 
} 

내 경로 : 나는 컨트롤러, 경로에 #id를 추가하는 시도

Route::get('/custom_paint', '[email protected]'); 

, 심지어에 뷰의 URL::to. 아무것도 작동하는 것 같습니다.

URI에 ID를 단순히 추가하는 것이 트릭을 수행 할 것이라고 생각했지만 분명히 나는 ​​누락되었습니다. 매개 변수는이

<a href="{{ route('custom_paint', 'param1') }}">LINK</a>

route처럼 사용에게 그것을 필요한 경우 간단히

<a href="{{ route('custom_paint') }}">LINK</a>

을 사용 .. 그것이 작동하는 희망)

+0

"경로에 #id를 추가하고 컨트롤러에, 심지어보기의 URL ::에 추가하기 위해 시도한 코드를 표시 할 수 있습니까?"? – Unnawut

답변

8
// Controller 
Route::get('/custom_paint', array('as' => 'custom_paint', 'uses' => '[email protected]')); 

// View 
<a href="{{ URL::route('custom_paint') }}#id">LINK</a> 

이 코드를 사용해보십시오

0

을,