Skip to content

Instantly share code, notes, and snippets.

@mpociot
Created February 19, 2020 07:11
Show Gist options
  • Save mpociot/d0b2d17d9e74128a6341b79c4c0c481e to your computer and use it in GitHub Desktop.
Save mpociot/d0b2d17d9e74128a6341b79c4c0c481e to your computer and use it in GitHub Desktop.
<?php
use Tinkerwell\ContextMenu\Label;
use Tinkerwell\ContextMenu\Submenu;
use Tinkerwell\ContextMenu\SetCode;
use Tinkerwell\ContextMenu\OpenURL;
class CustomLumenTinkerwellDriver extends TinkerwellDriver {
/**
* Determine if Driver can bootstrap by checking for public/index.php and bootstrap/app.php
*
* @param string $projectPath
* @return bool
*/
public function canBootstrap($projectPath)
{
return file_exists($projectPath . '/public/index.php') &&
file_exists($projectPath . '/bootstrap/app.php');
}
/**
* Bootstrap the Lumen application and run to get the base state
*
* @param string $projectPath
*/
public function bootstrap($projectPath)
{
ob_start();
$app = require $projectPath . '/bootstrap/app.php';
$app->run();
ob_end_clean();
}
/**
* Basic context menu, confirming Lumen version and a link to the Lumen Documentation
*
* @return array
*/
public function contextMenu()
{
return [
Label::create('Lumen Detected:'),
Label::create(app()->version()),
OpenURL::create('Documentation', 'https://lumen.laravel.com/docs/6.x'),
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment