Created
February 14, 2020 14:35
-
-
Save sschlein/67dd99d50a0b7913d48f0a3de62752d1 to your computer and use it in GitHub Desktop.
This file contains 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 | |
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