1. Go to this page and download the library: Download casa-parks/extract-routes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
casa-parks / extract-routes example snippets
'providers' => [
// Other service providers...
CasaParks\ExtractRoutes\ExtractRoutesServiceProvider::class,
],
namespace App\Composers;
use CasaParks\ExtractRoutes\Service as RoutesExtractor;
use Illuminate\Contracts\View\View;
class RoutesComposer
{
/**
* The routes extractor.
*
* @var \CasaParks\ExtractRoutes\Service
*/
protected $extractor;
/**
* Whether the data is cached or not.
*
* @var bool
*/
protected $cached;
/**
* The view data.
*
* @var array
*/
protected $data;
/**
* Creates a new routes composer.
*
* @param \CasaParks\ExtractRoutes\Service $extractor
*/
public function __construct(RoutesExtractor $extractor)
{
$this->extractor = $extractor;
}
/**
* Compose the view.
*
* @param \Illuminate\Contracts\View\View $view
*
* @return void
*/
public function compose(View $view)
{
if (! $this->cached) {
$this->cache();
}
$view->with($this->data);
}
/**
* Cache the data.
*
* @return void
*/
protected function cache()
{
$this->cached = true;
// We don't want to
/**
* Register any composers for your application.
*
* @return void
*/
public function boot()
{
// ...
// assuming `layout` is your common layout template.
$this->app['view']->composer('layout', 'App\Composers\RoutesComposer');
// ...
}