Skip to content

Instantly share code, notes, and snippets.

@sschlein
Created February 14, 2020 14:35
Show Gist options
  • Save sschlein/67dd99d50a0b7913d48f0a3de62752d1 to your computer and use it in GitHub Desktop.
Save sschlein/67dd99d50a0b7913d48f0a3de62752d1 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 CustomTinkerwellDriver 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_clean();
}
/**
* Basic context menu, confirming Lumen version and a link to the Lumen Documentation
*
* @return array
*/
public function contextMenu()
{
return [
Label::create('Lumen Detected: '.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