Show all available views

Submitted by mohamed - 10 years ago

This snippet can be used to view a linked list to all your available views, useful for reviewing different screens.

Route::get("{view}", function($view){
    return View::make($view);
});
 
Route::get("/", function(){
	$full_path = app_path().'\\views\\';
 
	if(!is_dir($full_path))
		return 'Views directory not found';
 
	$files = scandir($full_path);
	unset($files[0]);
	unset($files[1]);
 
	if(($key = array_search('emails', $files)) !== false) {
		unset($files[$key]);
	}
 
	foreach($files AS $file){
		$link = str_replace('.blade.php','',$file);
		echo '<a href="'.$link.'">'.$link.'</a>'.'<br>';
	}
});