Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created February 23, 2016 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/3483a12216013170db19 to your computer and use it in GitHub Desktop.
Save anonymous/3483a12216013170db19 to your computer and use it in GitHub Desktop.
Route::get('guidelines/{slug}/{page}', ['as' => 'guideline-page', function($slug, $page) {
$guideline = Guideline::findBySlugOrFail($slug);
$page = $guideline->guidelineBlocks()->where('slug', $page)->firstOrFail();
// previous pages
$previous = GuidelineBlock::where('guideline_blocks.guideline_id', '=', $guideline->id)
->where('guideline_blocks.id', '!=', $page->id)
->orderBy('guideline_blocks.position', 'asc')
->first();
echo $previous->title;
//print_r($previous);
die;
return layout('coma.guideline-page', [
'guideline' => $guideline,
'page' => $page,
]);
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment