From e72e0d79ebd519e8325b00d6eefcc38292171ebd Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Fri, 23 Jun 2017 10:59:04 +0100 Subject: [PATCH] Change laravel tinkering --- .env.example | 2 -- .psysh.php | 3 +++ composer.json | 1 + composer.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++- tinker.config.php | 38 --------------------------------- 5 files changed, 56 insertions(+), 41 deletions(-) create mode 100644 .psysh.php delete mode 100644 tinker.config.php diff --git a/.env.example b/.env.example index 72c19df3..57ea1e36 100644 --- a/.env.example +++ b/.env.example @@ -52,5 +52,3 @@ TWITTER_ACCESS_TOKEN_SECRET= SCOUT_DRIVER=pgsql PIWIK=false - -PSYSH_CONFIG=tinker.config.php diff --git a/.psysh.php b/.psysh.php new file mode 100644 index 00000000..d237947d --- /dev/null +++ b/.psysh.php @@ -0,0 +1,3 @@ +files()->name('*.php')->in(base_path().'/app'); - foreach ($finder as $file) { - $namespace = 'App\\'; - if ($relativePath = $file->getRelativePath()) { - $namespace .= strtr($relativePath, '/', '\\') . '\\'; - } - $class = $namespace . $file->getBasename('.php'); - try { - $r = new \ReflectionClass($class); - if ($r->isSubclassOf('Illuminate\\Database\\Eloquent\\Model')) { - class_alias($class, $file->getBasename('.php')); - } - } catch (Exception $e) { - // - } - } - } -} - -aliasModels(); - -return [ - 'startupMessage' => 'Using local config file (tinker.config.php)', - - 'commands' => [ - // new \App\Tinker\TestCommand, - ], -];