-
-
Save weotch/d7d7767236492732b2a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
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 = $guideline->guidelineBlocks() | |
->where('guideline_blocks.position', '<', $page->position) | |
->orderBy('guideline_blocks.position', 'desc') | |
->first(); | |
$next = $guideline->guidelineBlocks() | |
->where('guideline_blocks.position', '>', $page->position) | |
->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