update inbox list
This commit is contained in:
50
vendor/laravel/tinker/CHANGELOG.md
vendored
Normal file
50
vendor/laravel/tinker/CHANGELOG.md
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
# Release Notes
|
||||
|
||||
## [Unreleased](https://github.com/laravel/tinker/compare/v2.4.0...2.x)
|
||||
|
||||
|
||||
## [v2.4.0 (2020-04-07)](https://github.com/laravel/tinker/compare/v2.3.0...v2.4.0)
|
||||
|
||||
### Changed
|
||||
- Forward input options to psysh ([#98](https://github.com/laravel/tinker/pull/98))
|
||||
|
||||
|
||||
## [v2.3.0 (2020-03-17)](https://github.com/laravel/tinker/compare/v2.2.0...v2.3.0)
|
||||
|
||||
### Added
|
||||
- Allow Laravel 8 ([#90](https://github.com/laravel/tinker/pull/90))
|
||||
- Allow psy/psysh 0.10 ([#95](https://github.com/laravel/tinker/pull/95))
|
||||
|
||||
|
||||
## [v2.2.0 (2020-02-05)](https://github.com/laravel/tinker/compare/v2.1.0...v2.2.0)
|
||||
|
||||
### Added
|
||||
- Support vendor class aliasing ([#88](https://github.com/laravel/tinker/pull/88))
|
||||
- Add `--execute` option to console command ([#89](https://github.com/laravel/tinker/pull/89))
|
||||
|
||||
|
||||
## [v2.1.0 (2020-01-14)](https://github.com/laravel/tinker/compare/v2.0.0...v2.1.0)
|
||||
|
||||
### Added
|
||||
- Add `HtmlString` caster ([#87](https://github.com/laravel/tinker/pull/87))
|
||||
|
||||
|
||||
## [v2.0.0 (2019-11-26)](https://github.com/laravel/tinker/compare/v1.0.10...v2.0.0)
|
||||
|
||||
### Added
|
||||
- Allow Laravel 7 ([#74](https://github.com/laravel/tinker/pull/74))
|
||||
|
||||
### Changed
|
||||
- Require PHP 7.2 as the new minimum version ([8d6104c](https://github.com/laravel/tinker/commit/8d6104cf50695e3f256d0389626c692e144d946b))
|
||||
- Allow Symfony 5 ([49982fd](https://github.com/laravel/tinker/commit/49982fd563035025998efe7f32d005bc6da2ce0a))
|
||||
- Laravel now only check for `DeferrableProvider` ([#81](https://github.com/laravel/tinker/pull/81))
|
||||
|
||||
### Removed
|
||||
- Drop support for old Psysh versions ([a05922f](https://github.com/laravel/tinker/commit/a05922fa3b959d92efd16defe8e30a9895a69727))
|
||||
- Drop Symfony 3.x support ([7175b49](https://github.com/laravel/tinker/commit/7175b4931917d507989cda2c753113f71aa18816))
|
||||
- Drop support for Laravel 5.x ([4f3e609](https://github.com/laravel/tinker/commit/4f3e6098dff7ec4c0eedc5348184838598bc30c8))
|
||||
|
||||
|
||||
## v1.0.0 (2016-12-30)
|
||||
|
||||
Initial commit.
|
||||
21
vendor/laravel/tinker/LICENSE.md
vendored
Normal file
21
vendor/laravel/tinker/LICENSE.md
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Taylor Otwell
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
32
vendor/laravel/tinker/README.md
vendored
Normal file
32
vendor/laravel/tinker/README.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<p align="center"><img src="https://laravel.com/assets/img/components/logo-tinker.svg"></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/tinker"><img src="https://travis-ci.org/laravel/tinker.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/tinker"><img src="https://poser.pugx.org/laravel/tinker/d/total.svg" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/tinker"><img src="https://poser.pugx.org/laravel/tinker/v/stable.svg" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/tinker"><img src="https://poser.pugx.org/laravel/tinker/license.svg" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## Introduction
|
||||
|
||||
Laravel Tinker is a powerful REPL for the Laravel framework.
|
||||
|
||||
## Official Documentation
|
||||
|
||||
Documentation for Tinker can be found on the [Laravel website](https://laravel.com/docs/artisan#tinker).
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to Tinker! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
Please review [our security policy](https://github.com/laravel/tinker/security/policy) on how to report security vulnerabilities.
|
||||
|
||||
## License
|
||||
|
||||
Laravel Tinker is open-sourced software licensed under the [MIT license](LICENSE.md).
|
||||
54
vendor/laravel/tinker/composer.json
vendored
Normal file
54
vendor/laravel/tinker/composer.json
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"name": "laravel/tinker",
|
||||
"description": "Powerful REPL for the Laravel framework.",
|
||||
"keywords": ["tinker", "repl", "psysh", "laravel"],
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Taylor Otwell",
|
||||
"email": "taylor@laravel.com"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^7.2",
|
||||
"illuminate/console": "^6.0|^7.0|^8.0",
|
||||
"illuminate/contracts": "^6.0|^7.0|^8.0",
|
||||
"illuminate/support": "^6.0|^7.0|^8.0",
|
||||
"psy/psysh": "^0.10.3",
|
||||
"symfony/var-dumper": "^4.3|^5.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.1",
|
||||
"phpunit/phpunit": "^8.4|^9.0"
|
||||
},
|
||||
"suggest": {
|
||||
"illuminate/database": "The Illuminate Database package (^6.0|^7.0|^8.0)."
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Tinker\\": "src/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Laravel\\Tinker\\Tests\\": "tests/",
|
||||
"App\\": "tests/fixtures/app",
|
||||
"One\\Two\\": "tests/fixtures/vendor/one/two"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.x-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Laravel\\Tinker\\TinkerServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
50
vendor/laravel/tinker/config/tinker.php
vendored
Normal file
50
vendor/laravel/tinker/config/tinker.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to add additional Artisan commands that should
|
||||
| be available within the Tinker environment. Once the command is in
|
||||
| this array you may execute the command in Tinker using its name.
|
||||
|
|
||||
*/
|
||||
|
||||
'commands' => [
|
||||
// App\Console\Commands\ExampleCommand::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Alias Whitelist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Tinker will not automatically alias classes in your vendor namespaces
|
||||
| but you may explicitly allow a subset of classes to get aliased by
|
||||
| adding the names of each of those classes to the following list.
|
||||
|
|
||||
*/
|
||||
|
||||
'alias' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Alias Blacklist
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Typically, Tinker automatically aliases classes as you require them in
|
||||
| Tinker. However, you may wish to never alias certain classes, which
|
||||
| you may accomplish by listing the classes in the following array.
|
||||
|
|
||||
*/
|
||||
|
||||
'dont_alias' => [
|
||||
'App\Nova',
|
||||
],
|
||||
|
||||
];
|
||||
163
vendor/laravel/tinker/src/ClassAliasAutoloader.php
vendored
Normal file
163
vendor/laravel/tinker/src/ClassAliasAutoloader.php
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Tinker;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Psy\Shell;
|
||||
|
||||
class ClassAliasAutoloader
|
||||
{
|
||||
/**
|
||||
* The shell instance.
|
||||
*
|
||||
* @var \Psy\Shell
|
||||
*/
|
||||
protected $shell;
|
||||
|
||||
/**
|
||||
* All of the discovered classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $classes = [];
|
||||
|
||||
/**
|
||||
* Path to the vendor directory.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $vendorPath;
|
||||
|
||||
/**
|
||||
* Explicitly included namespaces/classes.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
protected $includedAliases;
|
||||
|
||||
/**
|
||||
* Excluded namespaces/classes.
|
||||
*
|
||||
* @var \Illuminate\Support\Collection
|
||||
*/
|
||||
protected $excludedAliases;
|
||||
|
||||
/**
|
||||
* Register a new alias loader instance.
|
||||
*
|
||||
* @param \Psy\Shell $shell
|
||||
* @param string $classMapPath
|
||||
* @param array $includedAliases
|
||||
* @param array $excludedAliases
|
||||
* @return static
|
||||
*/
|
||||
public static function register(Shell $shell, $classMapPath, array $includedAliases = [], array $excludedAliases = [])
|
||||
{
|
||||
return tap(new static($shell, $classMapPath, $includedAliases, $excludedAliases), function ($loader) {
|
||||
spl_autoload_register([$loader, 'aliasClass']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new alias loader instance.
|
||||
*
|
||||
* @param \Psy\Shell $shell
|
||||
* @param string $classMapPath
|
||||
* @param array $includedAliases
|
||||
* @param array $excludedAliases
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Shell $shell, $classMapPath, array $includedAliases = [], array $excludedAliases = [])
|
||||
{
|
||||
$this->shell = $shell;
|
||||
$this->vendorPath = dirname(dirname($classMapPath));
|
||||
$this->includedAliases = collect($includedAliases);
|
||||
$this->excludedAliases = collect($excludedAliases);
|
||||
|
||||
$classes = require $classMapPath;
|
||||
|
||||
foreach ($classes as $class => $path) {
|
||||
if (! $this->isAliasable($class, $path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$name = class_basename($class);
|
||||
|
||||
if (! isset($this->classes[$name])) {
|
||||
$this->classes[$name] = $class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the closest class by name.
|
||||
*
|
||||
* @param string $class
|
||||
* @return void
|
||||
*/
|
||||
public function aliasClass($class)
|
||||
{
|
||||
if (Str::contains($class, '\\')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$fullName = $this->classes[$class] ?? false;
|
||||
|
||||
if ($fullName) {
|
||||
$this->shell->writeStdout("[!] Aliasing '{$class}' to '{$fullName}' for this Tinker session.\n");
|
||||
|
||||
class_alias($fullName, $class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister the alias loader instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister([$this, 'aliasClass']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the destruction of the instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->unregister();
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a class may be aliased.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $path
|
||||
*/
|
||||
public function isAliasable($class, $path)
|
||||
{
|
||||
if (! Str::contains($class, '\\')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->includedAliases->filter(function ($alias) use ($class) {
|
||||
return Str::startsWith($class, $alias);
|
||||
})->isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Str::startsWith($path, $this->vendorPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $this->excludedAliases->filter(function ($alias) use ($class) {
|
||||
return Str::startsWith($class, $alias);
|
||||
})->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
156
vendor/laravel/tinker/src/Console/TinkerCommand.php
vendored
Normal file
156
vendor/laravel/tinker/src/Console/TinkerCommand.php
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Tinker\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Env;
|
||||
use Laravel\Tinker\ClassAliasAutoloader;
|
||||
use Psy\Configuration;
|
||||
use Psy\Shell;
|
||||
use Psy\VersionUpdater\Checker;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class TinkerCommand extends Command
|
||||
{
|
||||
/**
|
||||
* Artisan commands to include in the tinker shell.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commandWhitelist = [
|
||||
'clear-compiled', 'down', 'env', 'inspire', 'migrate', 'optimize', 'up',
|
||||
];
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'tinker';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Interact with your application';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->getApplication()->setCatchExceptions(false);
|
||||
|
||||
$config = Configuration::fromInput($this->input);
|
||||
$config->setUpdateCheck(Checker::NEVER);
|
||||
|
||||
$config->getPresenter()->addCasters(
|
||||
$this->getCasters()
|
||||
);
|
||||
|
||||
$shell = new Shell($config);
|
||||
$shell->addCommands($this->getCommands());
|
||||
$shell->setIncludes($this->argument('include'));
|
||||
|
||||
$path = Env::get('COMPOSER_VENDOR_DIR', $this->getLaravel()->basePath().DIRECTORY_SEPARATOR.'vendor');
|
||||
|
||||
$path .= '/composer/autoload_classmap.php';
|
||||
|
||||
$config = $this->getLaravel()->make('config');
|
||||
|
||||
$loader = ClassAliasAutoloader::register(
|
||||
$shell, $path, $config->get('tinker.alias', []), $config->get('tinker.dont_alias', [])
|
||||
);
|
||||
|
||||
if ($code = $this->option('execute')) {
|
||||
$shell->execute($code);
|
||||
|
||||
$loader->unregister();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
$shell->run();
|
||||
} finally {
|
||||
$loader->unregister();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get artisan commands to pass through to PsySH.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCommands()
|
||||
{
|
||||
$commands = [];
|
||||
|
||||
foreach ($this->getApplication()->all() as $name => $command) {
|
||||
if (in_array($name, $this->commandWhitelist)) {
|
||||
$commands[] = $command;
|
||||
}
|
||||
}
|
||||
|
||||
$config = $this->getLaravel()->make('config');
|
||||
|
||||
foreach ($config->get('tinker.commands', []) as $command) {
|
||||
$commands[] = $this->getApplication()->resolve($command);
|
||||
}
|
||||
|
||||
return $commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of Laravel tailored casters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCasters()
|
||||
{
|
||||
$casters = [
|
||||
'Illuminate\Support\Collection' => 'Laravel\Tinker\TinkerCaster::castCollection',
|
||||
'Illuminate\Support\HtmlString' => 'Laravel\Tinker\TinkerCaster::castHtmlString',
|
||||
];
|
||||
|
||||
if (class_exists('Illuminate\Database\Eloquent\Model')) {
|
||||
$casters['Illuminate\Database\Eloquent\Model'] = 'Laravel\Tinker\TinkerCaster::castModel';
|
||||
}
|
||||
|
||||
if (class_exists('Illuminate\Foundation\Application')) {
|
||||
$casters['Illuminate\Foundation\Application'] = 'Laravel\Tinker\TinkerCaster::castApplication';
|
||||
}
|
||||
|
||||
return $casters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [
|
||||
['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['execute', null, InputOption::VALUE_OPTIONAL, 'Execute the given code using Tinker'],
|
||||
];
|
||||
}
|
||||
}
|
||||
108
vendor/laravel/tinker/src/TinkerCaster.php
vendored
Normal file
108
vendor/laravel/tinker/src/TinkerCaster.php
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Tinker;
|
||||
|
||||
use Exception;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
|
||||
class TinkerCaster
|
||||
{
|
||||
/**
|
||||
* Application methods to include in the presenter.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $appProperties = [
|
||||
'configurationIsCached',
|
||||
'environment',
|
||||
'environmentFile',
|
||||
'isLocal',
|
||||
'routesAreCached',
|
||||
'runningUnitTests',
|
||||
'version',
|
||||
'path',
|
||||
'basePath',
|
||||
'configPath',
|
||||
'databasePath',
|
||||
'langPath',
|
||||
'publicPath',
|
||||
'storagePath',
|
||||
'bootstrapPath',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get an array representing the properties of an application.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return array
|
||||
*/
|
||||
public static function castApplication($app)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
foreach (self::$appProperties as $property) {
|
||||
try {
|
||||
$val = $app->$property();
|
||||
|
||||
if (! is_null($val)) {
|
||||
$results[Caster::PREFIX_VIRTUAL.$property] = $val;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array representing the properties of a collection.
|
||||
*
|
||||
* @param \Illuminate\Support\Collection $collection
|
||||
* @return array
|
||||
*/
|
||||
public static function castCollection($collection)
|
||||
{
|
||||
return [
|
||||
Caster::PREFIX_VIRTUAL.'all' => $collection->all(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array representing the properties of an html string.
|
||||
*
|
||||
* @param \Illuminate\Support\HtmlString $htmlString
|
||||
* @return array
|
||||
*/
|
||||
public static function castHtmlString($htmlString)
|
||||
{
|
||||
return [
|
||||
Caster::PREFIX_VIRTUAL.'html' => $htmlString->toHtml(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array representing the properties of a model.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
* @return array
|
||||
*/
|
||||
public static function castModel($model)
|
||||
{
|
||||
$attributes = array_merge(
|
||||
$model->getAttributes(), $model->getRelations()
|
||||
);
|
||||
|
||||
$visible = array_flip(
|
||||
$model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden())
|
||||
);
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach (array_intersect_key($attributes, $visible) as $key => $value) {
|
||||
$results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value;
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
54
vendor/laravel/tinker/src/TinkerServiceProvider.php
vendored
Normal file
54
vendor/laravel/tinker/src/TinkerServiceProvider.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Tinker;
|
||||
|
||||
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||
use Illuminate\Foundation\Application as LaravelApplication;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Laravel\Lumen\Application as LumenApplication;
|
||||
use Laravel\Tinker\Console\TinkerCommand;
|
||||
|
||||
class TinkerServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||
{
|
||||
/**
|
||||
* Boot the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$source = realpath($raw = __DIR__.'/../config/tinker.php') ?: $raw;
|
||||
|
||||
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
|
||||
$this->publishes([$source => config_path('tinker.php')]);
|
||||
} elseif ($this->app instanceof LumenApplication) {
|
||||
$this->app->configure('tinker');
|
||||
}
|
||||
|
||||
$this->mergeConfigFrom($source, 'tinker');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('command.tinker', function () {
|
||||
return new TinkerCommand;
|
||||
});
|
||||
|
||||
$this->commands(['command.tinker']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['command.tinker'];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user