My first commit of codes
This commit is contained in:
167
vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php
vendored
Normal file
167
vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php namespace Illuminate\Foundation;
|
||||
|
||||
class AliasLoader {
|
||||
|
||||
/**
|
||||
* The array of class aliases.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $aliases;
|
||||
|
||||
/**
|
||||
* Indicates if a loader has been registered.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $registered = false;
|
||||
|
||||
/**
|
||||
* The singleton instance of the loader.
|
||||
*
|
||||
* @var \Illuminate\Foundation\AliasLoader
|
||||
*/
|
||||
protected static $instance;
|
||||
|
||||
/**
|
||||
* Create a new AliasLoader instance.
|
||||
*
|
||||
* @param array $aliases
|
||||
*/
|
||||
private function __construct($aliases)
|
||||
{
|
||||
$this->aliases = $aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create the singleton alias loader instance.
|
||||
*
|
||||
* @param array $aliases
|
||||
* @return \Illuminate\Foundation\AliasLoader
|
||||
*/
|
||||
public static function getInstance(array $aliases = array())
|
||||
{
|
||||
if (is_null(static::$instance)) return static::$instance = new static($aliases);
|
||||
|
||||
$aliases = array_merge(static::$instance->getAliases(), $aliases);
|
||||
|
||||
static::$instance->setAliases($aliases);
|
||||
|
||||
return static::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a class alias if it is registered.
|
||||
*
|
||||
* @param string $alias
|
||||
* @return void
|
||||
*/
|
||||
public function load($alias)
|
||||
{
|
||||
if (isset($this->aliases[$alias]))
|
||||
{
|
||||
return class_alias($this->aliases[$alias], $alias);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an alias to the loader.
|
||||
*
|
||||
* @param string $class
|
||||
* @param string $alias
|
||||
* @return void
|
||||
*/
|
||||
public function alias($class, $alias)
|
||||
{
|
||||
$this->aliases[$class] = $alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the loader on the auto-loader stack.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
if ( ! $this->registered)
|
||||
{
|
||||
$this->prependToLoaderStack();
|
||||
|
||||
$this->registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend the load method to the auto-loader stack.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function prependToLoaderStack()
|
||||
{
|
||||
spl_autoload_register(array($this, 'load'), true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the registered aliases.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAliases()
|
||||
{
|
||||
return $this->aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the registered aliases.
|
||||
*
|
||||
* @param array $aliases
|
||||
* @return void
|
||||
*/
|
||||
public function setAliases(array $aliases)
|
||||
{
|
||||
$this->aliases = $aliases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the loader has been registered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isRegistered()
|
||||
{
|
||||
return $this->registered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "registered" state of the loader.
|
||||
*
|
||||
* @param bool $value
|
||||
* @return void
|
||||
*/
|
||||
public function setRegistered($value)
|
||||
{
|
||||
$this->registered = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the singleton alias loader.
|
||||
*
|
||||
* @param \Illuminate\Foundation\AliasLoader $loader
|
||||
* @return void
|
||||
*/
|
||||
public static function setInstance($loader)
|
||||
{
|
||||
static::$instance = $loader;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone method.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __clone()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
1076
vendor/laravel/framework/src/Illuminate/Foundation/Application.php
vendored
Normal file
1076
vendor/laravel/framework/src/Illuminate/Foundation/Application.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
138
vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
vendored
Normal file
138
vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
<?php namespace Illuminate\Foundation\Auth;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\Registrar;
|
||||
|
||||
trait AuthenticatesAndRegistersUsers {
|
||||
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* The registrar implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Auth\Registrar
|
||||
*/
|
||||
protected $registrar;
|
||||
|
||||
/**
|
||||
* Show the application registration form.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getRegister()
|
||||
{
|
||||
return view('auth.register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a registration request for the application.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function postRegister(Request $request)
|
||||
{
|
||||
$validator = $this->registrar->validator($request->all());
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
$this->throwValidationException(
|
||||
$request, $validator
|
||||
);
|
||||
}
|
||||
|
||||
$this->auth->login($this->registrar->create($request->all()));
|
||||
|
||||
return redirect($this->redirectPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application login form.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getLogin()
|
||||
{
|
||||
return view('auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a login request to the application.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function postLogin(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'email' => 'required|email', 'password' => 'required',
|
||||
]);
|
||||
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if ($this->auth->attempt($credentials, $request->has('remember')))
|
||||
{
|
||||
return redirect()->intended($this->redirectPath());
|
||||
}
|
||||
|
||||
return redirect($this->loginPath())
|
||||
->withInput($request->only('email', 'remember'))
|
||||
->withErrors([
|
||||
'email' => $this->getFailedLoginMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the failed login message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getFailedLoginMessage()
|
||||
{
|
||||
return 'These credentials do not match our records.';
|
||||
}
|
||||
|
||||
/**
|
||||
* Log the user out of the application.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getLogout()
|
||||
{
|
||||
$this->auth->logout();
|
||||
|
||||
return redirect(property_exists($this, 'redirectAfterLogout') ? $this->redirectAfterLogout : '/');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the post register / login redirect path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function redirectPath()
|
||||
{
|
||||
if (property_exists($this, 'redirectPath'))
|
||||
{
|
||||
return $this->redirectPath;
|
||||
}
|
||||
|
||||
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the login route.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function loginPath()
|
||||
{
|
||||
return property_exists($this, 'loginPath') ? $this->loginPath : '/auth/login';
|
||||
}
|
||||
|
||||
}
|
||||
139
vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php
vendored
Normal file
139
vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php namespace Illuminate\Foundation\Auth;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Contracts\Auth\PasswordBroker;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
trait ResetsPasswords {
|
||||
|
||||
/**
|
||||
* The Guard implementation.
|
||||
*
|
||||
* @var Guard
|
||||
*/
|
||||
protected $auth;
|
||||
|
||||
/**
|
||||
* The password broker implementation.
|
||||
*
|
||||
* @var PasswordBroker
|
||||
*/
|
||||
protected $passwords;
|
||||
|
||||
/**
|
||||
* Display the form to request a password reset link.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return view('auth.password');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function postEmail(Request $request)
|
||||
{
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
|
||||
$response = $this->passwords->sendResetLink($request->only('email'), function($m)
|
||||
{
|
||||
$m->subject($this->getEmailSubject());
|
||||
});
|
||||
|
||||
switch ($response)
|
||||
{
|
||||
case PasswordBroker::RESET_LINK_SENT:
|
||||
return redirect()->back()->with('status', trans($response));
|
||||
|
||||
case PasswordBroker::INVALID_USER:
|
||||
return redirect()->back()->withErrors(['email' => trans($response)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the e-mail subject line to be used for the reset link email.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getEmailSubject()
|
||||
{
|
||||
return isset($this->subject) ? $this->subject : 'Your Password Reset Link';
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the password reset view for the given token.
|
||||
*
|
||||
* @param string $token
|
||||
* @return Response
|
||||
*/
|
||||
public function getReset($token = null)
|
||||
{
|
||||
if (is_null($token))
|
||||
{
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
return view('auth.reset')->with('token', $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the given user's password.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function postReset(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'token' => 'required',
|
||||
'email' => 'required|email',
|
||||
'password' => 'required|confirmed',
|
||||
]);
|
||||
|
||||
$credentials = $request->only(
|
||||
'email', 'password', 'password_confirmation', 'token'
|
||||
);
|
||||
|
||||
$response = $this->passwords->reset($credentials, function($user, $password)
|
||||
{
|
||||
$user->password = bcrypt($password);
|
||||
|
||||
$user->save();
|
||||
|
||||
$this->auth->login($user);
|
||||
});
|
||||
|
||||
switch ($response)
|
||||
{
|
||||
case PasswordBroker::PASSWORD_RESET:
|
||||
return redirect($this->redirectPath());
|
||||
|
||||
default:
|
||||
return redirect()->back()
|
||||
->withInput($request->only('email'))
|
||||
->withErrors(['email' => trans($response)]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the post register / login redirect path.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function redirectPath()
|
||||
{
|
||||
if (property_exists($this, 'redirectPath'))
|
||||
{
|
||||
return $this->redirectPath;
|
||||
}
|
||||
|
||||
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
|
||||
}
|
||||
|
||||
}
|
||||
18
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php
vendored
Normal file
18
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class BootProviders {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$app->boot();
|
||||
}
|
||||
|
||||
}
|
||||
108
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php
vendored
Normal file
108
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Log\Writer;
|
||||
use Monolog\Logger as Monolog;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class ConfigureLogging {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$this->configureHandlers($app, $this->registerLogger($app));
|
||||
|
||||
// Next, we will bind a Closure that resolves the PSR logger implementation
|
||||
// as this will grant us the ability to be interoperable with many other
|
||||
// libraries which are able to utilize the PSR standardized interface.
|
||||
$app->bind('Psr\Log\LoggerInterface', function($app)
|
||||
{
|
||||
return $app['log']->getMonolog();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the logger instance in the container.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return \Illuminate\Log\Writer
|
||||
*/
|
||||
protected function registerLogger(Application $app)
|
||||
{
|
||||
$app->instance('log', $log = new Writer(
|
||||
new Monolog($app->environment()), $app['events'])
|
||||
);
|
||||
|
||||
return $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
* @return void
|
||||
*/
|
||||
protected function configureHandlers(Application $app, Writer $log)
|
||||
{
|
||||
$method = "configure".ucfirst($app['config']['app.log'])."Handler";
|
||||
|
||||
$this->{$method}($app, $log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
* @return void
|
||||
*/
|
||||
protected function configureSingleHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useFiles($app->storagePath().'/logs/laravel.log');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
* @return void
|
||||
*/
|
||||
protected function configureDailyHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useDailyFiles(
|
||||
$app->storagePath().'/logs/laravel.log',
|
||||
$app->make('config')->get('app.log_max_files', 5)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
* @return void
|
||||
*/
|
||||
protected function configureSyslogHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useSyslog('laravel');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
* @return void
|
||||
*/
|
||||
protected function configureErrorlogHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useErrorLog();
|
||||
}
|
||||
|
||||
}
|
||||
32
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
vendored
Normal file
32
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Dotenv;
|
||||
use InvalidArgumentException;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class DetectEnvironment {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dotenv::load($app->basePath(), $app->environmentFile());
|
||||
}
|
||||
catch (InvalidArgumentException $e)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
$app->detectEnvironment(function()
|
||||
{
|
||||
return env('APP_ENV', 'production');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
155
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
vendored
Normal file
155
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use ErrorException;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Debug\Exception\FatalErrorException;
|
||||
|
||||
class HandleExceptions {
|
||||
|
||||
/**
|
||||
* The application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
|
||||
error_reporting(-1);
|
||||
|
||||
set_error_handler([$this, 'handleError']);
|
||||
|
||||
set_exception_handler([$this, 'handleException']);
|
||||
|
||||
register_shutdown_function([$this, 'handleShutdown']);
|
||||
|
||||
if ( ! $app->environment('testing'))
|
||||
{
|
||||
ini_set('display_errors', 'Off');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a PHP error to an ErrorException.
|
||||
*
|
||||
* @param int $level
|
||||
* @param string $message
|
||||
* @param string $file
|
||||
* @param int $line
|
||||
* @param array $context
|
||||
* @return void
|
||||
*
|
||||
* @throws \ErrorException
|
||||
*/
|
||||
public function handleError($level, $message, $file = '', $line = 0, $context = array())
|
||||
{
|
||||
if (error_reporting() & $level)
|
||||
{
|
||||
throw new ErrorException($message, 0, $level, $file, $line);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an uncaught exception from the application.
|
||||
*
|
||||
* Note: Most exceptions can be handled via the try / catch block in
|
||||
* the HTTP and Console kernels. But, fatal error exceptions must
|
||||
* be handled differently since they are not normal exceptions.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function handleException($e)
|
||||
{
|
||||
$this->getExceptionHandler()->report($e);
|
||||
|
||||
if ($this->app->runningInConsole())
|
||||
{
|
||||
$this->renderForConsole($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->renderHttpResponse($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception to the console.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
protected function renderForConsole($e)
|
||||
{
|
||||
$this->getExceptionHandler()->renderForConsole(new ConsoleOutput, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception as an HTTP response and send it.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
protected function renderHttpResponse($e)
|
||||
{
|
||||
$this->getExceptionHandler()->render($this->app['request'], $e)->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the PHP shutdown event.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handleShutdown()
|
||||
{
|
||||
if ( ! is_null($error = error_get_last()) && $this->isFatal($error['type']))
|
||||
{
|
||||
$this->handleException($this->fatalExceptionFromError($error, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new fatal exception instance from an error array.
|
||||
*
|
||||
* @param array $error
|
||||
* @param int|null $traceOffset
|
||||
* @return \Symfony\Component\Debug\Exception\FatalErrorException
|
||||
*/
|
||||
protected function fatalExceptionFromError(array $error, $traceOffset = null)
|
||||
{
|
||||
return new FatalErrorException(
|
||||
$error['message'], $error['type'], 0, $error['file'], $error['line'], $traceOffset
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the error type is fatal.
|
||||
*
|
||||
* @param int $type
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFatal($type)
|
||||
{
|
||||
return in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the exception handler.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Debug\ExceptionHandler
|
||||
*/
|
||||
protected function getExceptionHandler()
|
||||
{
|
||||
return $this->app->make('Illuminate\Contracts\Debug\ExceptionHandler');
|
||||
}
|
||||
|
||||
}
|
||||
99
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
vendored
Normal file
99
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Config\Repository;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Config\Repository as RepositoryContract;
|
||||
|
||||
class LoadConfiguration {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$items = [];
|
||||
|
||||
// First we will see if we have a cache configuration file. If we do, we'll load
|
||||
// the configuration items from that file so that it is very quick. Otherwise
|
||||
// we will need to spin through every configuration file and load them all.
|
||||
if (file_exists($cached = $app->getCachedConfigPath()))
|
||||
{
|
||||
$items = require $cached;
|
||||
|
||||
$loadedFromCache = true;
|
||||
}
|
||||
|
||||
$app->instance('config', $config = new Repository($items));
|
||||
|
||||
// Next we will spin through all of the configuration files in the configuration
|
||||
// directory and load each one into the repository. This will make all of the
|
||||
// options available to the developer for use in various parts of this app.
|
||||
if ( ! isset($loadedFromCache))
|
||||
{
|
||||
$this->loadConfigurationFiles($app, $config);
|
||||
}
|
||||
|
||||
date_default_timezone_set($config['app.timezone']);
|
||||
|
||||
mb_internal_encoding('UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the configuration items from all of the files.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Contracts\Config\Repository $config
|
||||
* @return void
|
||||
*/
|
||||
protected function loadConfigurationFiles(Application $app, RepositoryContract $config)
|
||||
{
|
||||
foreach ($this->getConfigurationFiles($app) as $key => $path)
|
||||
{
|
||||
$config->set($key, require $path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the configuration files for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return array
|
||||
*/
|
||||
protected function getConfigurationFiles(Application $app)
|
||||
{
|
||||
$files = [];
|
||||
|
||||
foreach (Finder::create()->files()->name('*.php')->in($app->configPath()) as $file)
|
||||
{
|
||||
$nesting = $this->getConfigurationNesting($file);
|
||||
|
||||
$files[$nesting.basename($file->getRealPath(), '.php')] = $file->getRealPath();
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configuration file nesting path.
|
||||
*
|
||||
* @param \Symfony\Component\Finder\SplFileInfo $file
|
||||
* @return string
|
||||
*/
|
||||
private function getConfigurationNesting(SplFileInfo $file)
|
||||
{
|
||||
$directory = dirname($file->getRealPath());
|
||||
|
||||
if ($tree = trim(str_replace(config_path(), '', $directory), DIRECTORY_SEPARATOR))
|
||||
{
|
||||
$tree = str_replace(DIRECTORY_SEPARATOR, '.', $tree).'.';
|
||||
}
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
}
|
||||
24
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php
vendored
Normal file
24
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Foundation\AliasLoader;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class RegisterFacades {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
Facade::clearResolvedInstances();
|
||||
|
||||
Facade::setFacadeApplication($app);
|
||||
|
||||
AliasLoader::getInstance($app['config']['app.aliases'])->register();
|
||||
}
|
||||
|
||||
}
|
||||
18
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php
vendored
Normal file
18
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class RegisterProviders {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$app->registerConfiguredProviders();
|
||||
}
|
||||
|
||||
}
|
||||
21
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php
vendored
Normal file
21
vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php namespace Illuminate\Foundation\Bootstrap;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
|
||||
class SetRequestForConsole {
|
||||
|
||||
/**
|
||||
* Bootstrap the given application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap(Application $app)
|
||||
{
|
||||
$url = $app['config']->get('app.url', 'http://localhost');
|
||||
|
||||
$app->instance('request', Request::create($url, 'GET', [], [], [], $_SERVER));
|
||||
}
|
||||
|
||||
}
|
||||
43
vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php
vendored
Normal file
43
vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php namespace Illuminate\Foundation\Bus;
|
||||
|
||||
use ArrayAccess;
|
||||
|
||||
trait DispatchesCommands {
|
||||
|
||||
/**
|
||||
* Dispatch a command to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @return mixed
|
||||
*/
|
||||
protected function dispatch($command)
|
||||
{
|
||||
return app('Illuminate\Contracts\Bus\Dispatcher')->dispatch($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal a command and dispatch it to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @param array $array
|
||||
* @return mixed
|
||||
*/
|
||||
protected function dispatchFromArray($command, array $array)
|
||||
{
|
||||
return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFromArray($command, $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marshal a command and dispatch it to its appropriate handler.
|
||||
*
|
||||
* @param mixed $command
|
||||
* @param \ArrayAccess $source
|
||||
* @param array $extras
|
||||
* @return mixed
|
||||
*/
|
||||
protected function dispatchFrom($command, ArrayAccess $source, $extras = [])
|
||||
{
|
||||
return app('Illuminate\Contracts\Bus\Dispatcher')->dispatchFrom($command, $source, $extras);
|
||||
}
|
||||
|
||||
}
|
||||
98
vendor/laravel/framework/src/Illuminate/Foundation/Composer.php
vendored
Normal file
98
vendor/laravel/framework/src/Illuminate/Foundation/Composer.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php namespace Illuminate\Foundation;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
class Composer {
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* The working path to regenerate from.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $workingPath;
|
||||
|
||||
/**
|
||||
* Create a new Composer manager instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @param string $workingPath
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files, $workingPath = null)
|
||||
{
|
||||
$this->files = $files;
|
||||
$this->workingPath = $workingPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the Composer autoloader files.
|
||||
*
|
||||
* @param string $extra
|
||||
* @return void
|
||||
*/
|
||||
public function dumpAutoloads($extra = '')
|
||||
{
|
||||
$process = $this->getProcess();
|
||||
|
||||
$process->setCommandLine(trim($this->findComposer().' dump-autoload '.$extra));
|
||||
|
||||
$process->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Regenerate the optimized Composer autoloader files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function dumpOptimized()
|
||||
{
|
||||
$this->dumpAutoloads('--optimize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the composer command for the environment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function findComposer()
|
||||
{
|
||||
if ($this->files->exists($this->workingPath.'/composer.phar'))
|
||||
{
|
||||
return '"'.PHP_BINARY.'" composer.phar';
|
||||
}
|
||||
|
||||
return 'composer';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a new Symfony process instance.
|
||||
*
|
||||
* @return \Symfony\Component\Process\Process
|
||||
*/
|
||||
protected function getProcess()
|
||||
{
|
||||
return (new Process('', $this->workingPath))->setTimeout(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the working path used by the class.
|
||||
*
|
||||
* @param string $path
|
||||
* @return $this
|
||||
*/
|
||||
public function setWorkingPath($path)
|
||||
{
|
||||
$this->workingPath = realpath($path);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
328
vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php
vendored
Normal file
328
vendor/laravel/framework/src/Illuminate/Foundation/Console/AppNameCommand.php
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Composer;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Console\AppNamespaceDetectorTrait;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class AppNameCommand extends Command {
|
||||
|
||||
use AppNamespaceDetectorTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'app:name';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Set the application namespace";
|
||||
|
||||
/**
|
||||
* The Composer class instance.
|
||||
*
|
||||
* @var \Illuminate\Foundation\Composer
|
||||
*/
|
||||
protected $composer;
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Current root application namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $currentRoot;
|
||||
|
||||
/**
|
||||
* Create a new key generator command.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Composer $composer
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Composer $composer, Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
$this->composer = $composer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->currentRoot = trim($this->getAppNamespace(), '\\');
|
||||
|
||||
$this->setBootstrapNamespaces();
|
||||
|
||||
$this->setAppDirectoryNamespace();
|
||||
|
||||
$this->setConfigNamespaces();
|
||||
|
||||
$this->setComposerNamespace();
|
||||
|
||||
$this->setPhpSpecNamespace();
|
||||
|
||||
$this->info('Application namespace set!');
|
||||
|
||||
$this->composer->dumpAutoloads();
|
||||
|
||||
$this->call('clear-compiled');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the namespace on the files in the app directory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setAppDirectoryNamespace()
|
||||
{
|
||||
$files = Finder::create()
|
||||
->in($this->laravel['path'])
|
||||
->name('*.php');
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$this->replaceNamespace($file->getRealPath());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the App namespace at the given path.
|
||||
*
|
||||
* @param string $path
|
||||
*/
|
||||
protected function replaceNamespace($path)
|
||||
{
|
||||
$search = [
|
||||
'namespace '.$this->currentRoot.';',
|
||||
$this->currentRoot.'\\',
|
||||
];
|
||||
|
||||
$replace = [
|
||||
'namespace '.$this->argument('name').';',
|
||||
$this->argument('name').'\\',
|
||||
];
|
||||
|
||||
$this->replaceIn($path, $search, $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bootstrap namespaces.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setBootstrapNamespaces()
|
||||
{
|
||||
$search = [
|
||||
$this->currentRoot.'\\Http',
|
||||
$this->currentRoot.'\\Console',
|
||||
$this->currentRoot.'\\Exceptions',
|
||||
];
|
||||
|
||||
$replace = [
|
||||
$this->argument('name').'\\Http',
|
||||
$this->argument('name').'\\Console',
|
||||
$this->argument('name').'\\Exceptions',
|
||||
];
|
||||
|
||||
$this->replaceIn($this->getBootstrapPath(), $search, $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PSR-4 namespace in the Composer file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setComposerNamespace()
|
||||
{
|
||||
$this->replaceIn(
|
||||
$this->getComposerPath(), $this->currentRoot.'\\\\', str_replace('\\', '\\\\', $this->argument('name')).'\\\\'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the namespace in the appropriate configuration files.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setConfigNamespaces()
|
||||
{
|
||||
$this->setAppConfigNamespaces();
|
||||
|
||||
$this->setAuthConfigNamespace();
|
||||
|
||||
$this->setServicesConfigNamespace();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application provider namespaces.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setAppConfigNamespaces()
|
||||
{
|
||||
$search = [
|
||||
$this->currentRoot.'\\Providers',
|
||||
$this->currentRoot.'\\Http\\Controllers\\',
|
||||
];
|
||||
|
||||
$replace = [
|
||||
$this->argument('name').'\\Providers',
|
||||
$this->argument('name').'\\Http\\Controllers\\',
|
||||
];
|
||||
|
||||
$this->replaceIn($this->getConfigPath('app'), $search, $replace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the authentication User namespace.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setAuthConfigNamespace()
|
||||
{
|
||||
$this->replaceIn(
|
||||
$this->getAuthConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the services User namespace.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setServicesConfigNamespace()
|
||||
{
|
||||
$this->replaceIn(
|
||||
$this->getServicesConfigPath(), $this->currentRoot.'\\User', $this->argument('name').'\\User'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the PHPSpec configuration namespace.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setPhpSpecNamespace()
|
||||
{
|
||||
if ($this->files->exists($path = $this->getPhpSpecConfigPath()))
|
||||
{
|
||||
$this->replaceIn($path, $this->currentRoot, $this->argument('name'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the given string in the given file.
|
||||
*
|
||||
* @param string $path
|
||||
* @param string|array $search
|
||||
* @param string|array $replace
|
||||
* @return void
|
||||
*/
|
||||
protected function replaceIn($path, $search, $replace)
|
||||
{
|
||||
$this->files->put($path, str_replace($search, $replace, $this->files->get($path)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the Core User class.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getUserClassPath()
|
||||
{
|
||||
return $this->laravel['path'].'/Core/User.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the bootstrap/app.php file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getBootstrapPath()
|
||||
{
|
||||
return $this->laravel->basePath().'/bootstrap/app.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the Composer.json file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getComposerPath()
|
||||
{
|
||||
return $this->laravel->basePath().'/composer.json';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the given configuration file.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function getConfigPath($name)
|
||||
{
|
||||
return $this->laravel['path.config'].'/'.$name.'.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the authentication configuration file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getAuthConfigPath()
|
||||
{
|
||||
return $this->getConfigPath('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the services configuration file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getServicesConfigPath()
|
||||
{
|
||||
return $this->getConfigPath('services');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the PHPSpec configuration file.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getPhpSpecConfigPath()
|
||||
{
|
||||
return $this->laravel->basePath().'/phpspec.yml';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('name', InputArgument::REQUIRED, 'The desired namespace.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
42
vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php
vendored
Normal file
42
vendor/laravel/framework/src/Illuminate/Foundation/Console/ClearCompiledCommand.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ClearCompiledCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'clear-compiled';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Remove the compiled class file";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$compiledPath = $this->laravel->getCachedCompilePath();
|
||||
$servicesPath = $this->laravel->getCachedServicesPath();
|
||||
|
||||
if (file_exists($compiledPath))
|
||||
{
|
||||
@unlink($compiledPath);
|
||||
}
|
||||
|
||||
if (file_exists($servicesPath))
|
||||
{
|
||||
@unlink($servicesPath);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
97
vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php
vendored
Normal file
97
vendor/laravel/framework/src/Illuminate/Foundation/Console/CommandMakeCommand.php
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class CommandMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new command class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Command';
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
parent::fire();
|
||||
|
||||
if ($this->option('handler'))
|
||||
{
|
||||
$this->call('handler:command', [
|
||||
'name' => $this->argument('name').'Handler',
|
||||
'--command' => $this->parseName($this->argument('name')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
if ($this->option('queued') && $this->option('handler'))
|
||||
{
|
||||
return __DIR__.'/stubs/command-queued-with-handler.stub';
|
||||
}
|
||||
elseif ($this->option('queued'))
|
||||
{
|
||||
return __DIR__.'/stubs/command-queued.stub';
|
||||
}
|
||||
elseif ($this->option('handler'))
|
||||
{
|
||||
return __DIR__.'/stubs/command-with-handler.stub';
|
||||
}
|
||||
else
|
||||
{
|
||||
return __DIR__.'/stubs/command.stub';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Commands';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('handler', null, InputOption::VALUE_NONE, 'Indicates that handler class should be generated.'),
|
||||
|
||||
array('queued', null, InputOption::VALUE_NONE, 'Indicates that command should be queued.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
93
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php
vendored
Normal file
93
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ConfigCacheCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'config:cache';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a cache file for faster configuration loading';
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Create a new config cache command instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->call('config:clear');
|
||||
|
||||
$config = $this->setRealSessionDriver(
|
||||
$this->getFreshConfiguration()
|
||||
);
|
||||
|
||||
$this->files->put(
|
||||
$this->laravel->getCachedConfigPath(), '<?php return '.var_export($config, true).';'.PHP_EOL
|
||||
);
|
||||
|
||||
$this->info('Configuration cached successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot a fresh copy of the application configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getFreshConfiguration()
|
||||
{
|
||||
$app = require $this->laravel->basePath().'/bootstrap/app.php';
|
||||
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
return $app['config']->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the "real" session driver on the configuration array.
|
||||
*
|
||||
* Typically the SessionManager forces the driver to "array" in CLI environment.
|
||||
*
|
||||
* @param array $config
|
||||
* @return array
|
||||
*/
|
||||
protected function setRealSessionDriver(array $config)
|
||||
{
|
||||
$session = require $this->laravel->configPath().'/session.php';
|
||||
|
||||
$config['session']['driver'] = $session['driver'];
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
}
|
||||
54
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php
vendored
Normal file
54
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigClearCommand.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class ConfigClearCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'config:clear';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Remove the configuration cache file';
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Create a new config clear command instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->files->delete($this->laravel->getCachedConfigPath());
|
||||
|
||||
$this->info('Configuration cache cleared!');
|
||||
}
|
||||
|
||||
}
|
||||
89
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php
vendored
Normal file
89
vendor/laravel/framework/src/Illuminate/Foundation/Console/ConsoleMakeCommand.php
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class ConsoleMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:console';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Create a new Artisan command";
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Console command';
|
||||
|
||||
/**
|
||||
* Replace the class name for the given stub.
|
||||
*
|
||||
* @param string $stub
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function replaceClass($stub, $name)
|
||||
{
|
||||
$stub = parent::replaceClass($stub, $name);
|
||||
|
||||
return str_replace('{{command}}', $this->option('command'), $stub);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/console.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Console\Commands';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array(
|
||||
array('name', InputArgument::REQUIRED, 'The name of the command.'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('command', null, InputOption::VALUE_OPTIONAL, 'The terminal command that should be assigned.', 'command:name'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php
vendored
Normal file
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/DownCommand.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class DownCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'down';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Put the application into maintenance mode";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
touch($this->laravel->storagePath().'/framework/down');
|
||||
|
||||
$this->comment('Application is now in maintenance mode.');
|
||||
}
|
||||
|
||||
}
|
||||
31
vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php
vendored
Normal file
31
vendor/laravel/framework/src/Illuminate/Foundation/Console/EnvironmentCommand.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class EnvironmentCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'env';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Display the current framework environment";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->line('<info>Current application environment:</info> <comment>'.$this->laravel['env'].'</comment>');
|
||||
}
|
||||
|
||||
}
|
||||
48
vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php
vendored
Normal file
48
vendor/laravel/framework/src/Illuminate/Foundation/Console/EventGenerateCommand.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class EventGenerateCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'event:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate the missing events and handlers based on registration';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$provider = $this->laravel->getProvider(
|
||||
'Illuminate\Foundation\Support\Providers\EventServiceProvider'
|
||||
);
|
||||
|
||||
foreach ($provider->listens() as $event => $handlers)
|
||||
{
|
||||
if ( ! str_contains($event, '\\'))
|
||||
continue;
|
||||
|
||||
$this->callSilent('make:event', ['name' => $event]);
|
||||
|
||||
foreach ($handlers as $handler)
|
||||
{
|
||||
$this->callSilent('handler:event', ['name' => $handler, '--event' => $event]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Events and handlers generated successfully!');
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php
vendored
Normal file
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/EventMakeCommand.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
|
||||
class EventMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:event';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new event class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Event';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/event.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Events';
|
||||
}
|
||||
|
||||
}
|
||||
71
vendor/laravel/framework/src/Illuminate/Foundation/Console/FreshCommand.php
vendored
Normal file
71
vendor/laravel/framework/src/Illuminate/Foundation/Console/FreshCommand.php
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Console\ConfirmableTrait;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class FreshCommand extends Command {
|
||||
|
||||
use ConfirmableTrait;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'fresh';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Remove the scaffolding included with the framework";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
if ( ! $this->confirmToProceed()) return;
|
||||
|
||||
$files = new Filesystem;
|
||||
|
||||
$files->deleteDirectory(app_path('Services'));
|
||||
$files->delete(base_path('resources/views/app.blade.php'));
|
||||
$files->delete(base_path('resources/views/home.blade.php'));
|
||||
$files->deleteDirectory(app_path('Http/Controllers/Auth'));
|
||||
$files->deleteDirectory(base_path('resources/views/auth'));
|
||||
$files->deleteDirectory(base_path('resources/views/emails'));
|
||||
$files->delete(app_path('Http/Controllers/HomeController.php'));
|
||||
|
||||
$files->deleteDirectory(base_path('public/css'));
|
||||
$files->deleteDirectory(base_path('public/fonts'));
|
||||
$files->put(base_path('resources/assets/less/app.less'), ''.PHP_EOL);
|
||||
$files->deleteDirectory(base_path('resources/assets/less/bootstrap'));
|
||||
|
||||
$files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
|
||||
$files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));
|
||||
|
||||
$files->put(app_path('Http/routes.php'), $files->get(__DIR__.'/stubs/fresh-routes.stub'));
|
||||
$files->put(app_path('Providers/AppServiceProvider.php'), $files->get(__DIR__.'/stubs/fresh-app-provider.stub'));
|
||||
|
||||
$this->info('Scaffolding removed! Enjoy your fresh start.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
83
vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php
vendored
Normal file
83
vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerCommandCommand.php
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class HandlerCommandCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'handler:command';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new command handler class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Handler';
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
{
|
||||
$stub = parent::buildClass($name);
|
||||
|
||||
$stub = str_replace(
|
||||
'{{command}}', class_basename($this->option('command')), $stub
|
||||
);
|
||||
|
||||
$stub = str_replace(
|
||||
'{{fullCommand}}', $this->option('command'), $stub
|
||||
);
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/command-handler.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Handlers\Commands';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('command', null, InputOption::VALUE_REQUIRED, 'The command class the handler handles.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
99
vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php
vendored
Normal file
99
vendor/laravel/framework/src/Illuminate/Foundation/Console/HandlerEventCommand.php
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class HandlerEventCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'handler:event';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new event handler class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Handler';
|
||||
|
||||
/**
|
||||
* Build the class with the given name.
|
||||
*
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
protected function buildClass($name)
|
||||
{
|
||||
$stub = parent::buildClass($name);
|
||||
|
||||
$event = $this->option('event');
|
||||
|
||||
if ( ! starts_with($event, $this->getAppNamespace()))
|
||||
{
|
||||
$event = $this->getAppNamespace().'Events\\'.$event;
|
||||
}
|
||||
|
||||
$stub = str_replace(
|
||||
'{{event}}', class_basename($event), $stub
|
||||
);
|
||||
|
||||
$stub = str_replace(
|
||||
'{{fullEvent}}', $event, $stub
|
||||
);
|
||||
|
||||
return $stub;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
if ($this->option('queued'))
|
||||
{
|
||||
return __DIR__.'/stubs/event-handler-queued.stub';
|
||||
}
|
||||
else
|
||||
{
|
||||
return __DIR__.'/stubs/event-handler.stub';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Handlers\Events';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('event', null, InputOption::VALUE_REQUIRED, 'The event class the handler handles.'),
|
||||
|
||||
array('queued', null, InputOption::VALUE_NONE, 'Indicates the event handler should be queued.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
250
vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
vendored
Normal file
250
vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Console\Application as Artisan;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Console\Kernel as KernelContract;
|
||||
|
||||
class Kernel implements KernelContract {
|
||||
|
||||
/**
|
||||
* The application implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The event dispatcher implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Events\Dispatcher
|
||||
*/
|
||||
protected $events;
|
||||
|
||||
/**
|
||||
* The Artisan application instance.
|
||||
*
|
||||
* @var \Illuminate\Console\Application
|
||||
*/
|
||||
protected $artisan;
|
||||
|
||||
/**
|
||||
* The bootstrap classes for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bootstrappers = [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'Illuminate\Foundation\Bootstrap\ConfigureLogging',
|
||||
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
||||
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||
'Illuminate\Foundation\Bootstrap\BootProviders',
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a new console kernel instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Application $app, Dispatcher $events)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->events = $events;
|
||||
|
||||
$this->app->booted(function()
|
||||
{
|
||||
$this->defineConsoleSchedule();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function defineConsoleSchedule()
|
||||
{
|
||||
$this->app->instance(
|
||||
'Illuminate\Console\Scheduling\Schedule', $schedule = new Schedule
|
||||
);
|
||||
|
||||
$this->schedule($schedule);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the console application.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
public function handle($input, $output = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
$this->bootstrap();
|
||||
|
||||
return $this->getArtisan()->run($input, $output);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->reportException($e);
|
||||
|
||||
$this->renderException($output, $e);
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Terminate the application.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param int $status
|
||||
* @return void
|
||||
*/
|
||||
public function terminate($input, $status)
|
||||
{
|
||||
$this->app->terminate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Run an Artisan console command by name.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $parameters
|
||||
* @return int
|
||||
*/
|
||||
public function call($command, array $parameters = array())
|
||||
{
|
||||
$this->bootstrap();
|
||||
|
||||
// If we are calling a arbitary command from within the application, we will load
|
||||
// all of the available deferred providers which will make all of the commands
|
||||
// available to an application. Otherwise the command will not be available.
|
||||
$this->app->loadDeferredProviders();
|
||||
|
||||
return $this->getArtisan()->call($command, $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue the given console command.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $parameters
|
||||
* @return void
|
||||
*/
|
||||
public function queue($command, array $parameters = array())
|
||||
{
|
||||
$this->app['Illuminate\Contracts\Queue\Queue']->push(
|
||||
'Illuminate\Foundation\Console\QueuedJob', func_get_args()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the commands registered with the console.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$this->bootstrap();
|
||||
|
||||
return $this->getArtisan()->all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output for the last run command.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function output()
|
||||
{
|
||||
$this->bootstrap();
|
||||
|
||||
return $this->getArtisan()->output();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the application for HTTP requests.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap()
|
||||
{
|
||||
if ( ! $this->app->hasBeenBootstrapped())
|
||||
{
|
||||
$this->app->bootstrapWith($this->bootstrappers());
|
||||
}
|
||||
|
||||
$this->app->loadDeferredProviders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Artisan application instance.
|
||||
*
|
||||
* @return \Illuminate\Console\Application
|
||||
*/
|
||||
protected function getArtisan()
|
||||
{
|
||||
if (is_null($this->artisan))
|
||||
{
|
||||
return $this->artisan = (new Artisan($this->app, $this->events, $this->app->version()))
|
||||
->resolveCommands($this->commands);
|
||||
}
|
||||
|
||||
return $this->artisan;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bootstrap classes for the application.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function bootstrappers()
|
||||
{
|
||||
return $this->bootstrappers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the exception to the exception handler.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
protected function reportException(Exception $e)
|
||||
{
|
||||
$this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the exception to the exception handler.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
protected function renderException($output, Exception $e)
|
||||
{
|
||||
$this->app['Illuminate\Contracts\Debug\ExceptionHandler']->renderForConsole($output, $e);
|
||||
}
|
||||
|
||||
}
|
||||
73
vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php
vendored
Normal file
73
vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class KeyGenerateCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'key:generate';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Set the application key";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$key = $this->getRandomKey();
|
||||
|
||||
if ($this->option('show'))
|
||||
{
|
||||
return $this->line('<comment>'.$key.'</comment>');
|
||||
}
|
||||
|
||||
$path = base_path('.env');
|
||||
|
||||
if (file_exists($path))
|
||||
{
|
||||
file_put_contents($path, str_replace(
|
||||
$this->laravel['config']['app.key'], $key, file_get_contents($path)
|
||||
));
|
||||
}
|
||||
|
||||
$this->laravel['config']['app.key'] = $key;
|
||||
|
||||
$this->info("Application key [$key] set successfully.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a random key for the application.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRandomKey()
|
||||
{
|
||||
return Str::random(32);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('show', null, InputOption::VALUE_NONE, 'Simply display the key instead of modifying files.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
79
vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php
vendored
Normal file
79
vendor/laravel/framework/src/Illuminate/Foundation/Console/ModelMakeCommand.php
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ModelMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:model';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new Eloquent model class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Model';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
parent::fire();
|
||||
|
||||
if ( ! $this->option('no-migration'))
|
||||
{
|
||||
$table = str_plural(snake_case(class_basename($this->argument('name'))));
|
||||
|
||||
$this->call('make:migration', ['name' => "create_{$table}_table", '--create' => $table]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/model.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('no-migration', null, InputOption::VALUE_NONE, 'Do not create a new migration file.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
211
vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php
vendored
Normal file
211
vendor/laravel/framework/src/Illuminate/Foundation/Console/Optimize/config.php
vendored
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
$basePath = $app['path.base'];
|
||||
|
||||
return array_map('realpath', array(
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Container/ContextualBindingBuilder.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Foundation/Application.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Bus/Dispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Bus/QueueingDispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Bus/HandlerResolver.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Pipeline/Pipeline.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Renderable.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/ResponsePreparer.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Logging/Log.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Exception/Handler.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Config/Repository.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Url/Generator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Events/Dispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Arrayable.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/Jsonable.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/Factory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Cookie/QueueingFactory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Encryption/Encrypter.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Queue/QueueableEntity.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/HttpKernel.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Registrar.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/ResponseFactory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlGenerator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/UrlRoutable.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/Middleware.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Routing/TerminableMiddleware.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Validation/ValidatesWhenResolved.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/Factory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Support/MessageBag.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/View/View.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Http/Kernel.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Auth/Guard.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Hashing/Hasher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Auth/Guard.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Auth/UserProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Auth/EloquentUserProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Container/Container.php',
|
||||
$basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php',
|
||||
$basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Application.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesAndRegistersUsers.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Auth/ResetsPasswords.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Http/Request.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Http/Middleware/FrameGuard.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeaderItem.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/AcceptHeader.php',
|
||||
$basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ExceptionHandler.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/ServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/AggregateServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Events/EventServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Bus/DispatchesCommands.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/EventServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Auth/AuthServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Hashing/HashServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Hashing/BcryptHasher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Contracts/Pagination/Paginator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/AbstractPaginator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Arr.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Str.php',
|
||||
$basePath.'/vendor/symfony/debug/Symfony/Component/Debug/ErrorHandler.php',
|
||||
$basePath.'/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Config/Repository.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/NamespacedItemResolver.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Config/FileLoader.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Config/LoaderInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/AliasLoader.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/CookieServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Session/SessionServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/ViewServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Router.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Route.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php',
|
||||
$basePath.'/vendor/symfony/routing/Symfony/Component/Routing/CompiledRoute.php',
|
||||
$basePath.'/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php',
|
||||
$basePath.'/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php',
|
||||
$basePath.'/vendor/symfony/routing/Symfony/Component/Routing/Route.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Controller.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/ControllerInspector.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Bus/BusServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/ValidatorInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/HostValidator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/MethodValidator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/SchemeValidator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/ConnectionResolverInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Session/SessionInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Session/Store.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Session/SessionManager.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Manager.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Collection.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/CookieJar.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Log.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Log/Writer.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Logger.php',
|
||||
$basePath.'/vendor/psr/log/Psr/Log/LoggerInterface.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php',
|
||||
$basePath.'/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/App.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/Route.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Engines/EngineResolver.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/ViewFinderInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Factory.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/ViewErrorBag.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/MessageBag.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Support/Facades/View.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/View.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Engines/EngineInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/CompilerInterface.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/Compiler.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php',
|
||||
$basePath.'/vendor/laravel/framework/src/Illuminate/Http/Response.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php',
|
||||
$basePath.'/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php',
|
||||
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/StringUtils.php',
|
||||
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandomInterface.php',
|
||||
$basePath.'/vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/SplFileInfo.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/Regex.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/ValueInterface.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Expression/Expression.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FilterIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/PathFilterIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/RecursiveDirectoryIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Iterator/FileTypeFilterIterator.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Shell/Shell.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AdapterInterface.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AbstractAdapter.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/AbstractFindAdapter.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/GnuFindAdapter.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/PhpAdapter.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Adapter/BsdFindAdapter.php',
|
||||
$basePath.'/vendor/symfony/finder/Symfony/Component/Finder/Finder.php',
|
||||
$basePath.'/vendor/nesbot/carbon/src/Carbon/Carbon.php',
|
||||
));
|
||||
135
vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php
vendored
Normal file
135
vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Foundation\Composer;
|
||||
use ClassPreloader\Command\PreCompileCommand;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class OptimizeCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'optimize';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Optimize the framework for better performance";
|
||||
|
||||
/**
|
||||
* The composer instance.
|
||||
*
|
||||
* @var \Illuminate\Foundation\Composer
|
||||
*/
|
||||
protected $composer;
|
||||
|
||||
/**
|
||||
* Create a new optimize command instance.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Composer $composer
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Composer $composer)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->composer = $composer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->info('Generating optimized class loader');
|
||||
|
||||
if ($this->option('psr'))
|
||||
{
|
||||
$this->composer->dumpAutoloads();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->composer->dumpOptimized();
|
||||
}
|
||||
|
||||
if ($this->option('force') || ! $this->laravel['config']['app.debug'])
|
||||
{
|
||||
$this->info('Compiling common classes');
|
||||
|
||||
$this->compileClasses();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->call('clear-compiled');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the compiled class file.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function compileClasses()
|
||||
{
|
||||
$this->registerClassPreloaderCommand();
|
||||
|
||||
$this->callSilent('compile', array(
|
||||
'--config' => implode(',', $this->getClassFiles()),
|
||||
'--output' => $this->laravel->getCachedCompilePath(),
|
||||
'--strip_comments' => 1,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the classes that should be combined and compiled.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getClassFiles()
|
||||
{
|
||||
$app = $this->laravel;
|
||||
|
||||
$core = require __DIR__.'/Optimize/config.php';
|
||||
|
||||
$files = array_merge($core, $this->laravel['config']->get('compile.files', []));
|
||||
|
||||
foreach ($this->laravel['config']->get('compile.providers', []) as $provider)
|
||||
{
|
||||
$files = array_merge($files, forward_static_call([$provider, 'compiles']));
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the pre-compiler command instance with Artisan.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerClassPreloaderCommand()
|
||||
{
|
||||
$this->getApplication()->add(new PreCompileCommand);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('force', null, InputOption::VALUE_NONE, 'Force the compiled class file to be written.'),
|
||||
|
||||
array('psr', null, InputOption::VALUE_NONE, 'Do not optimize Composer dump-autoload.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php
vendored
Normal file
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/ProviderMakeCommand.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
|
||||
class ProviderMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:provider';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new service provider class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Provider';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/provider.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Providers';
|
||||
}
|
||||
|
||||
}
|
||||
39
vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedJob.php
vendored
Normal file
39
vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedJob.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Contracts\Console\Kernel as KernelContract;
|
||||
|
||||
class QueuedJob {
|
||||
|
||||
/**
|
||||
* The kernel instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Console\Kernel
|
||||
*/
|
||||
protected $kernel;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Console\Kernel $kernel
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(KernelContract $kernel)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire the job.
|
||||
*
|
||||
* @param \Illuminate\Queue\Jobs\Job
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function fire($job, $data)
|
||||
{
|
||||
call_user_func_array([$this->kernel, 'call'], $data);
|
||||
|
||||
$job->delete();
|
||||
}
|
||||
|
||||
}
|
||||
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php
vendored
Normal file
49
vendor/laravel/framework/src/Illuminate/Foundation/Console/RequestMakeCommand.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\GeneratorCommand;
|
||||
|
||||
class RequestMakeCommand extends GeneratorCommand {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'make:request';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a new form request class';
|
||||
|
||||
/**
|
||||
* The type of class being generated.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $type = 'Request';
|
||||
|
||||
/**
|
||||
* Get the stub file for the generator.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getStub()
|
||||
{
|
||||
return __DIR__.'/stubs/request.stub';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default namespace for the class.
|
||||
*
|
||||
* @param string $rootNamespace
|
||||
* @return string
|
||||
*/
|
||||
protected function getDefaultNamespace($rootNamespace)
|
||||
{
|
||||
return $rootNamespace.'\Http\Requests';
|
||||
}
|
||||
|
||||
}
|
||||
98
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php
vendored
Normal file
98
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Routing\RouteCollection;
|
||||
|
||||
class RouteCacheCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'route:cache';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create a route cache file for faster route registration';
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Create a new route command instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->call('route:clear');
|
||||
|
||||
$routes = $this->getFreshApplicationRoutes();
|
||||
|
||||
if (count($routes) == 0)
|
||||
{
|
||||
return $this->error("Your application doesn't have any routes.");
|
||||
}
|
||||
|
||||
foreach ($routes as $route)
|
||||
{
|
||||
$route->prepareForSerialization();
|
||||
}
|
||||
|
||||
$this->files->put(
|
||||
$this->laravel->getCachedRoutesPath(), $this->buildRouteCacheFile($routes)
|
||||
);
|
||||
|
||||
$this->info('Routes cached successfully!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Boot a fresh copy of the application and get the routes.
|
||||
*
|
||||
* @return \Illuminate\Routing\RouteCollection
|
||||
*/
|
||||
protected function getFreshApplicationRoutes()
|
||||
{
|
||||
$app = require $this->laravel->basePath().'/bootstrap/app.php';
|
||||
|
||||
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();
|
||||
|
||||
return $app['router']->getRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the route cache file.
|
||||
*
|
||||
* @param \Illuminate\Routing\RouteCollection $routes
|
||||
* @return string
|
||||
*/
|
||||
protected function buildRouteCacheFile(RouteCollection $routes)
|
||||
{
|
||||
$stub = $this->files->get(__DIR__.'/stubs/routes.stub');
|
||||
|
||||
return str_replace('{{routes}}', base64_encode(serialize($routes)), $stub);
|
||||
}
|
||||
|
||||
}
|
||||
54
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php
vendored
Normal file
54
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteClearCommand.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
|
||||
class RouteClearCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'route:clear';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Remove the route cache file';
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* Create a new route clear command instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->files->delete($this->laravel->getCachedRoutesPath());
|
||||
|
||||
$this->info('Route cache cleared!');
|
||||
}
|
||||
|
||||
}
|
||||
270
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php
vendored
Normal file
270
vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php
vendored
Normal file
@@ -0,0 +1,270 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class RouteListCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'route:list';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'List all registered routes';
|
||||
|
||||
/**
|
||||
* The router instance.
|
||||
*
|
||||
* @var \Illuminate\Routing\Router
|
||||
*/
|
||||
protected $router;
|
||||
|
||||
/**
|
||||
* An array of all the registered routes.
|
||||
*
|
||||
* @var \Illuminate\Routing\RouteCollection
|
||||
*/
|
||||
protected $routes;
|
||||
|
||||
/**
|
||||
* The table headers for the command.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = array(
|
||||
'Domain', 'Method', 'URI', 'Name', 'Action', 'Middleware',
|
||||
);
|
||||
|
||||
/**
|
||||
* Create a new route command instance.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Router $router)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->router = $router;
|
||||
$this->routes = $router->getRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (count($this->routes) == 0)
|
||||
{
|
||||
return $this->error("Your application doesn't have any routes.");
|
||||
}
|
||||
|
||||
$this->displayRoutes($this->getRoutes());
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the routes into a displayable format.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getRoutes()
|
||||
{
|
||||
$results = array();
|
||||
|
||||
foreach ($this->routes as $route)
|
||||
{
|
||||
$results[] = $this->getRouteInformation($route);
|
||||
}
|
||||
|
||||
return array_filter($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route information for a given route.
|
||||
*
|
||||
* @param \Illuminate\Routing\Route $route
|
||||
* @return array
|
||||
*/
|
||||
protected function getRouteInformation(Route $route)
|
||||
{
|
||||
return $this->filterRoute(array(
|
||||
'host' => $route->domain(),
|
||||
'method' => implode('|', $route->methods()),
|
||||
'uri' => $route->uri(),
|
||||
'name' => $route->getName(),
|
||||
'action' => $route->getActionName(),
|
||||
'middleware' => $this->getMiddleware($route),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the route information on the console.
|
||||
*
|
||||
* @param array $routes
|
||||
* @return void
|
||||
*/
|
||||
protected function displayRoutes(array $routes)
|
||||
{
|
||||
$this->table($this->headers, $routes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get before filters.
|
||||
*
|
||||
* @param \Illuminate\Routing\Route $route
|
||||
* @return string
|
||||
*/
|
||||
protected function getMiddleware($route)
|
||||
{
|
||||
$middlewares = array_values($route->middleware());
|
||||
|
||||
$middlewares = array_unique(
|
||||
array_merge($middlewares, $this->getPatternFilters($route))
|
||||
);
|
||||
|
||||
$actionName = $route->getActionName();
|
||||
|
||||
if ( ! empty($actionName) && $actionName !== 'Closure')
|
||||
{
|
||||
$middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName));
|
||||
}
|
||||
|
||||
return implode(',', $middlewares);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the middleware for the given Controller@action name.
|
||||
*
|
||||
* @param string $actionName
|
||||
* @return array
|
||||
*/
|
||||
protected function getControllerMiddleware($actionName)
|
||||
{
|
||||
Controller::setRouter($this->laravel['router']);
|
||||
|
||||
$segments = explode('@', $actionName);
|
||||
|
||||
return $this->getControllerMiddlewareFromInstance(
|
||||
$this->laravel->make($segments[0]), $segments[1]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the middlewares for the given controller instance and method.
|
||||
*
|
||||
* @param \Illuminate\Routing\Controller $controller
|
||||
* @param string $method
|
||||
* @return array
|
||||
*/
|
||||
protected function getControllerMiddlewareFromInstance($controller, $method)
|
||||
{
|
||||
$middleware = $this->router->getMiddleware();
|
||||
|
||||
$results = [];
|
||||
|
||||
foreach ($controller->getMiddleware() as $name => $options)
|
||||
{
|
||||
if ( ! $this->methodExcludedByOptions($method, $options))
|
||||
{
|
||||
$results[] = array_get($middleware, $name, $name);
|
||||
}
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given options exclude a particular method.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $options
|
||||
* @return bool
|
||||
*/
|
||||
protected function methodExcludedByOptions($method, array $options)
|
||||
{
|
||||
return ( ! empty($options['only']) && ! in_array($method, (array) $options['only'])) ||
|
||||
( ! empty($options['except']) && in_array($method, (array) $options['except']));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the pattern filters matching the route.
|
||||
*
|
||||
* @param \Illuminate\Routing\Route $route
|
||||
* @return array
|
||||
*/
|
||||
protected function getPatternFilters($route)
|
||||
{
|
||||
$patterns = array();
|
||||
|
||||
foreach ($route->methods() as $method)
|
||||
{
|
||||
// For each method supported by the route we will need to gather up the patterned
|
||||
// filters for that method. We will then merge these in with the other filters
|
||||
// we have already gathered up then return them back out to these consumers.
|
||||
$inner = $this->getMethodPatterns($route->uri(), $method);
|
||||
|
||||
$patterns = array_merge($patterns, array_keys($inner));
|
||||
}
|
||||
|
||||
return $patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pattern filters for a given URI and method.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param string $method
|
||||
* @return array
|
||||
*/
|
||||
protected function getMethodPatterns($uri, $method)
|
||||
{
|
||||
return $this->router->findPatternFilters(
|
||||
Request::create($uri, $method)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the route by URI and / or name.
|
||||
*
|
||||
* @param array $route
|
||||
* @return array|null
|
||||
*/
|
||||
protected function filterRoute(array $route)
|
||||
{
|
||||
if (($this->option('name') && ! str_contains($route['name'], $this->option('name'))) ||
|
||||
$this->option('path') && ! str_contains($route['uri'], $this->option('path')))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
return $route;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name.'),
|
||||
|
||||
array('path', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by path.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
56
vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php
vendored
Normal file
56
vendor/laravel/framework/src/Illuminate/Foundation/Console/ServeCommand.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class ServeCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'serve';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Serve the application on the PHP development server";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
chdir($this->laravel->publicPath());
|
||||
|
||||
$host = $this->input->getOption('host');
|
||||
|
||||
$port = $this->input->getOption('port');
|
||||
|
||||
$base = $this->laravel->basePath();
|
||||
|
||||
$this->info("Laravel development server started on http://{$host}:{$port}/");
|
||||
|
||||
passthru('"'.PHP_BINARY.'"'." -S {$host}:{$port} \"{$base}\"/server.php");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('host', null, InputOption::VALUE_OPTIONAL, 'The host address to serve the application on.', 'localhost'),
|
||||
|
||||
array('port', null, InputOption::VALUE_OPTIONAL, 'The port to serve the application on.', 8000),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php namespace Illuminate\Foundation\Console\Tinker\Presenters;
|
||||
|
||||
use ReflectionClass;
|
||||
use ReflectionProperty;
|
||||
use Psy\Presenter\ObjectPresenter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EloquentModelPresenter extends ObjectPresenter {
|
||||
|
||||
/**
|
||||
* Determine if the presenter can present the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function canPresent($value)
|
||||
{
|
||||
return $value instanceof Model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of Model object properties.
|
||||
*
|
||||
* @param object $value
|
||||
* @param \ReflectionClass $class
|
||||
* @param int $propertyFilter
|
||||
* @return array
|
||||
*/
|
||||
public function getProperties($value, ReflectionClass $class, $propertyFilter)
|
||||
{
|
||||
$attributes = array_merge($value->getAttributes(), $value->getRelations());
|
||||
|
||||
$visible = $value->getVisible();
|
||||
|
||||
if (count($visible) === 0)
|
||||
{
|
||||
$visible = array_diff(array_keys($attributes), $value->getHidden());
|
||||
}
|
||||
|
||||
if ( ! $this->showHidden($propertyFilter))
|
||||
{
|
||||
return array_intersect_key($attributes, array_flip($visible));
|
||||
}
|
||||
|
||||
$properties = [];
|
||||
|
||||
foreach ($attributes as $key => $value)
|
||||
{
|
||||
if ( ! in_array($key, $visible))
|
||||
{
|
||||
$key = sprintf('<protected>%s</protected>', $key);
|
||||
}
|
||||
|
||||
$properties[$key] = $value;
|
||||
}
|
||||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide whether to show hidden properties, based on a ReflectionProperty filter.
|
||||
*
|
||||
* @param int $propertyFilter
|
||||
* @return bool
|
||||
*/
|
||||
protected function showHidden($propertyFilter)
|
||||
{
|
||||
return $propertyFilter & (ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php namespace Illuminate\Foundation\Console\Tinker\Presenters;
|
||||
|
||||
use Exception;
|
||||
use ReflectionClass;
|
||||
use Psy\Presenter\ObjectPresenter;
|
||||
use Illuminate\Foundation\Application;
|
||||
|
||||
class IlluminateApplicationPresenter extends ObjectPresenter {
|
||||
|
||||
/**
|
||||
* Illuminate Application methods to include in the presenter.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $appProperties = [
|
||||
'configurationIsCached',
|
||||
'environment',
|
||||
'environmentFile',
|
||||
'isLocal',
|
||||
'routesAreCached',
|
||||
'runningUnitTests',
|
||||
'version',
|
||||
'path',
|
||||
'basePath',
|
||||
'configPath',
|
||||
'databasePath',
|
||||
'langPath',
|
||||
'publicPath',
|
||||
'storagePath',
|
||||
];
|
||||
|
||||
/**
|
||||
* Determine if the presenter can present the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function canPresent($value)
|
||||
{
|
||||
return $value instanceof Application;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of Application object properties.
|
||||
*
|
||||
* @param object $value
|
||||
* @param \ReflectionClass $class
|
||||
* @param int $propertyFilter
|
||||
* @return array
|
||||
*/
|
||||
public function getProperties($value, ReflectionClass $class, $propertyFilter)
|
||||
{
|
||||
$properties = [];
|
||||
|
||||
foreach (self::$appProperties as $property)
|
||||
{
|
||||
try
|
||||
{
|
||||
$val = $value->$property();
|
||||
|
||||
if ( ! is_null($val)) $properties[$property] = $val;
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
return $properties;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php namespace Illuminate\Foundation\Console\Tinker\Presenters;
|
||||
|
||||
use Psy\Presenter\ArrayPresenter;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class IlluminateCollectionPresenter extends ArrayPresenter {
|
||||
|
||||
/**
|
||||
* Determine if the presenter can present the given value.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function canPresent($value)
|
||||
{
|
||||
return $value instanceof Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given value is a collection.
|
||||
*
|
||||
* @param object $value
|
||||
* @return bool
|
||||
*/
|
||||
protected function isArrayObject($value)
|
||||
{
|
||||
return $value instanceof Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of collection values.
|
||||
*
|
||||
* @param object $value
|
||||
* @return array
|
||||
*/
|
||||
protected function getArrayObjectValue($value)
|
||||
{
|
||||
return $value->all();
|
||||
}
|
||||
|
||||
}
|
||||
101
vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php
vendored
Normal file
101
vendor/laravel/framework/src/Illuminate/Foundation/Console/TinkerCommand.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Psy\Shell;
|
||||
use Psy\Configuration;
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Illuminate\Foundation\Console\Tinker\Presenters\EloquentModelPresenter;
|
||||
use Illuminate\Foundation\Console\Tinker\Presenters\IlluminateCollectionPresenter;
|
||||
use Illuminate\Foundation\Console\Tinker\Presenters\IlluminateApplicationPresenter;
|
||||
|
||||
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 void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->getApplication()->setCatchExceptions(false);
|
||||
|
||||
$config = new Configuration;
|
||||
|
||||
$config->getPresenterManager()->addPresenters(
|
||||
$this->getPresenters()
|
||||
);
|
||||
|
||||
$shell = new Shell($config);
|
||||
$shell->addCommands($this->getCommands());
|
||||
$shell->setIncludes($this->argument('include'));
|
||||
|
||||
$shell->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
return $commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of Laravel tailored Presenters.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getPresenters()
|
||||
{
|
||||
return [
|
||||
new EloquentModelPresenter,
|
||||
new IlluminateCollectionPresenter,
|
||||
new IlluminateApplicationPresenter,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [
|
||||
['include', InputArgument::IS_ARRAY, 'Include file(s) before starting tinker'],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php
vendored
Normal file
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/UpCommand.php
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class UpCommand extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'up';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Bring the application out of maintenance mode";
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
@unlink($this->laravel->storagePath().'/framework/down');
|
||||
|
||||
$this->info('Application is now live.');
|
||||
}
|
||||
|
||||
}
|
||||
175
vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php
vendored
Normal file
175
vendor/laravel/framework/src/Illuminate/Foundation/Console/VendorPublishCommand.php
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
<?php namespace Illuminate\Foundation\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use League\Flysystem\MountManager;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use League\Flysystem\Filesystem as Flysystem;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use League\Flysystem\Adapter\Local as LocalAdapter;
|
||||
|
||||
class VendorPublishCommand extends Command {
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'vendor:publish';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = "Publish any publishable assets from vendor packages";
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @param \Illuminate\Filesystem\Filesystem
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Filesystem $files)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$paths = ServiceProvider::pathsToPublish(
|
||||
$this->option('provider'), $this->option('tag')
|
||||
);
|
||||
|
||||
if (empty($paths))
|
||||
{
|
||||
return $this->comment("Nothing to publish.");
|
||||
}
|
||||
|
||||
foreach ($paths as $from => $to)
|
||||
{
|
||||
if ($this->files->isFile($from))
|
||||
{
|
||||
$this->publishFile($from, $to);
|
||||
}
|
||||
elseif ($this->files->isDirectory($from))
|
||||
{
|
||||
$this->publishDirectory($from, $to);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error("Can't locate path: <{$from}>");
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Publishing Complete!');
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish the file to the given path.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @return void
|
||||
*/
|
||||
protected function publishFile($from, $to)
|
||||
{
|
||||
if ($this->files->exists($to) && ! $this->option('force'))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$this->createParentDirectory(dirname($to));
|
||||
|
||||
$this->files->copy($from, $to);
|
||||
|
||||
$this->status($from, $to, 'File');
|
||||
}
|
||||
|
||||
/**
|
||||
* Publish the directory to the given directory.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @return void
|
||||
*/
|
||||
protected function publishDirectory($from, $to)
|
||||
{
|
||||
$manager = new MountManager([
|
||||
'from' => new Flysystem(new LocalAdapter($from)),
|
||||
'to' => new Flysystem(new LocalAdapter($to)),
|
||||
]);
|
||||
|
||||
foreach ($manager->listContents('from://', true) as $file)
|
||||
{
|
||||
if ($file['type'] === 'file' && ( ! $manager->has('to://'.$file['path']) || $this->option('force')))
|
||||
{
|
||||
$manager->put('to://'.$file['path'], $manager->read('from://'.$file['path']));
|
||||
}
|
||||
}
|
||||
|
||||
$this->status($from, $to, 'Directory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the directory to house the published files if needed.
|
||||
*
|
||||
* @param string $directory
|
||||
* @return void
|
||||
*/
|
||||
protected function createParentDirectory($directory)
|
||||
{
|
||||
if ( ! $this->files->isDirectory($directory))
|
||||
{
|
||||
$this->files->makeDirectory($directory, 0755, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a status message to the console.
|
||||
*
|
||||
* @param string $from
|
||||
* @param string $to
|
||||
* @param string $type
|
||||
* @return void
|
||||
*/
|
||||
protected function status($from, $to, $type)
|
||||
{
|
||||
$from = str_replace(base_path(), '', realpath($from));
|
||||
|
||||
$to = str_replace(base_path(), '', realpath($to));
|
||||
|
||||
$this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array(
|
||||
array('force', null, InputOption::VALUE_NONE, 'Overwrite any existing files.'),
|
||||
|
||||
array('provider', null, InputOption::VALUE_OPTIONAL, 'The service provider that has assets you want to publish.'),
|
||||
|
||||
array('tag', null, InputOption::VALUE_OPTIONAL, 'The tag that has assets you want to publish.'),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
30
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub
vendored
Normal file
30
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-handler.stub
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{fullCommand}};
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
|
||||
class {{class}} {
|
||||
|
||||
/**
|
||||
* Create the command handler.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the command.
|
||||
*
|
||||
* @param {{command}} $command
|
||||
* @return void
|
||||
*/
|
||||
public function handle({{command}} $command)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Commands\Command;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
||||
|
||||
class {{class}} extends Command implements ShouldBeQueued {
|
||||
|
||||
use InteractsWithQueue, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
34
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-queued.stub
vendored
Normal file
34
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-queued.stub
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Commands\Command;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Bus\SelfHandling;
|
||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
||||
|
||||
class {{class}} extends Command implements SelfHandling, ShouldBeQueued {
|
||||
|
||||
use InteractsWithQueue, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
17
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-with-handler.stub
vendored
Normal file
17
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command-with-handler.stub
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Commands\Command;
|
||||
|
||||
class {{class}} extends Command {
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
29
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command.stub
vendored
Normal file
29
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/command.stub
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Commands\Command;
|
||||
|
||||
use Illuminate\Contracts\Bus\SelfHandling;
|
||||
|
||||
class {{class}} extends Command implements SelfHandling {
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
67
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/console.stub
vendored
Normal file
67
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/console.stub
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class {{class}} extends Command {
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '{{command}}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [
|
||||
['example', InputArgument::REQUIRED, 'An example argument.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler-queued.stub
vendored
Normal file
33
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler-queued.stub
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{fullEvent}};
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
||||
|
||||
class {{class}} implements ShouldBeQueued {
|
||||
|
||||
use InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* Create the event handler.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param {{event}} $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle({{event}} $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
31
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler.stub
vendored
Normal file
31
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event-handler.stub
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{fullEvent}};
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldBeQueued;
|
||||
|
||||
class {{class}} {
|
||||
|
||||
/**
|
||||
* Create the event handler.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param {{event}} $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle({{event}} $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
21
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event.stub
vendored
Normal file
21
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/event.stub
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Events\Event;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class {{class}} extends Event {
|
||||
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
27
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/fresh-app-provider.stub
vendored
Normal file
27
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/fresh-app-provider.stub
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
14
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/fresh-routes.stub
vendored
Normal file
14
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/fresh-routes.stub
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register all of the routes for an application.
|
||||
| It's a breeze. Simply tell Laravel the URIs it should respond to
|
||||
| and give it the controller to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', 'WelcomeController@index');
|
||||
9
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub
vendored
Normal file
9
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/model.stub
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class {{class}} extends Model {
|
||||
|
||||
//
|
||||
|
||||
}
|
||||
27
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/provider.stub
vendored
Normal file
27
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/provider.stub
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class {{class}} extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
29
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/request.stub
vendored
Normal file
29
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/request.stub
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php namespace {{namespace}};
|
||||
|
||||
use {{rootNamespace}}Http\Requests\Request;
|
||||
|
||||
class {{class}} extends Request {
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
16
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/routes.stub
vendored
Normal file
16
vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/routes.stub
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Load The Cached Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here we will decode and unserialize the RouteCollection instance that
|
||||
| holds all of the route information for an application. This allows
|
||||
| us to instantaneously load the entire route map into the router.
|
||||
|
|
||||
*/
|
||||
|
||||
app('router')->setRoutes(
|
||||
unserialize(base64_decode('{{routes}}'))
|
||||
);
|
||||
69
vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php
vendored
Normal file
69
vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php namespace Illuminate\Foundation;
|
||||
|
||||
use Closure;
|
||||
|
||||
class EnvironmentDetector {
|
||||
|
||||
/**
|
||||
* Detect the application's current environment.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @param array|null $consoleArgs
|
||||
* @return string
|
||||
*/
|
||||
public function detect(Closure $callback, $consoleArgs = null)
|
||||
{
|
||||
if ($consoleArgs)
|
||||
{
|
||||
return $this->detectConsoleEnvironment($callback, $consoleArgs);
|
||||
}
|
||||
|
||||
return $this->detectWebEnvironment($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application environment for a web request.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @return string
|
||||
*/
|
||||
protected function detectWebEnvironment(Closure $callback)
|
||||
{
|
||||
return call_user_func($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application environment from command-line arguments.
|
||||
*
|
||||
* @param \Closure $callback
|
||||
* @param array $args
|
||||
* @return string
|
||||
*/
|
||||
protected function detectConsoleEnvironment(Closure $callback, array $args)
|
||||
{
|
||||
// First we will check if an environment argument was passed via console arguments
|
||||
// and if it was that automatically overrides as the environment. Otherwise, we
|
||||
// will check the environment as a "web" request like a typical HTTP request.
|
||||
if ( ! is_null($value = $this->getEnvironmentArgument($args)))
|
||||
{
|
||||
return head(array_slice(explode('=', $value), 1));
|
||||
}
|
||||
|
||||
return $this->detectWebEnvironment($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the environment argument from the console.
|
||||
*
|
||||
* @param array $args
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getEnvironmentArgument(array $args)
|
||||
{
|
||||
return array_first($args, function($k, $v)
|
||||
{
|
||||
return starts_with($v, '--env');
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
139
vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php
vendored
Normal file
139
vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php namespace Illuminate\Foundation\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\Console\Application as ConsoleApplication;
|
||||
use Symfony\Component\Debug\ExceptionHandler as SymfonyDisplayer;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler as ExceptionHandlerContract;
|
||||
|
||||
class Handler implements ExceptionHandlerContract {
|
||||
|
||||
/**
|
||||
* The log implementation.
|
||||
*
|
||||
* @var \Psr\Log\LoggerInterface
|
||||
*/
|
||||
protected $log;
|
||||
|
||||
/**
|
||||
* A list of the exception types that should not be reported.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontReport = [];
|
||||
|
||||
/**
|
||||
* Create a new exception handler instance.
|
||||
*
|
||||
* @param \Psr\Log\LoggerInterface $log
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(LoggerInterface $log)
|
||||
{
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report or log an exception.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $e)
|
||||
{
|
||||
if ($this->shouldntReport($e)) return;
|
||||
|
||||
$this->log->error((string) $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the exception should be reported.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldReport(Exception $e)
|
||||
{
|
||||
return ! $this->shouldntReport($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the exception is in the "do not report" list.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return bool
|
||||
*/
|
||||
protected function shouldntReport(Exception $e)
|
||||
{
|
||||
foreach ($this->dontReport as $type)
|
||||
{
|
||||
if ($e instanceof $type) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception into a response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request, Exception $e)
|
||||
{
|
||||
if ($this->isHttpException($e))
|
||||
{
|
||||
return $this->renderHttpException($e);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an exception to the console.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
public function renderForConsole($output, Exception $e)
|
||||
{
|
||||
(new ConsoleApplication)->renderException($e, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the given HttpException.
|
||||
*
|
||||
* @param \Symfony\Component\HttpKernel\Exception\HttpException $e
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
protected function renderHttpException(HttpException $e)
|
||||
{
|
||||
$status = $e->getStatusCode();
|
||||
|
||||
if (view()->exists("errors.{$status}"))
|
||||
{
|
||||
return response()->view("errors.{$status}", [], $status);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (new SymfonyDisplayer(config('app.debug')))->createResponse($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given exception is an HTTP exception.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return bool
|
||||
*/
|
||||
protected function isHttpException(Exception $e)
|
||||
{
|
||||
return $e instanceof HttpException;
|
||||
}
|
||||
|
||||
}
|
||||
233
vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php
vendored
Normal file
233
vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php namespace Illuminate\Foundation\Http;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Http\Exception\HttpResponseException;
|
||||
use Illuminate\Validation\ValidatesWhenResolvedTrait;
|
||||
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
|
||||
|
||||
class FormRequest extends Request implements ValidatesWhenResolved {
|
||||
|
||||
use ValidatesWhenResolvedTrait;
|
||||
|
||||
/**
|
||||
* The container instance.
|
||||
*
|
||||
* @var \Illuminate\Container\Container
|
||||
*/
|
||||
protected $container;
|
||||
|
||||
/**
|
||||
* The redirector instance.
|
||||
*
|
||||
* @var \Illuminate\Routing\Redirector
|
||||
*/
|
||||
protected $redirector;
|
||||
|
||||
/**
|
||||
* The URI to redirect to if validation fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirect;
|
||||
|
||||
/**
|
||||
* The route to redirect to if validation fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectRoute;
|
||||
|
||||
/**
|
||||
* The controller action to redirect to if validation fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectAction;
|
||||
|
||||
/**
|
||||
* The key to be used for the view error bag.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $errorBag = 'default';
|
||||
|
||||
/**
|
||||
* The input keys that should not be flashed on redirect.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dontFlash = ['password', 'password_confirmation'];
|
||||
|
||||
/**
|
||||
* Get the validator instance for the request.
|
||||
*
|
||||
* @return \Illuminate\Validation\Validator
|
||||
*/
|
||||
protected function getValidatorInstance()
|
||||
{
|
||||
$factory = $this->container->make('Illuminate\Validation\Factory');
|
||||
|
||||
if (method_exists($this, 'validator'))
|
||||
{
|
||||
return $this->container->call([$this, 'validator'], compact('factory'));
|
||||
}
|
||||
|
||||
return $factory->make(
|
||||
$this->all(), $this->container->call([$this, 'rules']), $this->messages(), $this->attributes()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a failed validation attempt.
|
||||
*
|
||||
* @param \Illuminate\Validation\Validator $validator
|
||||
* @return mixed
|
||||
*/
|
||||
protected function failedValidation(Validator $validator)
|
||||
{
|
||||
throw new HttpResponseException($this->response(
|
||||
$this->formatErrors($validator)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the request passes the authorization check.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function passesAuthorization()
|
||||
{
|
||||
if (method_exists($this, 'authorize'))
|
||||
{
|
||||
return $this->container->call([$this, 'authorize']);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a failed authorization attempt.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function failedAuthorization()
|
||||
{
|
||||
throw new HttpResponseException($this->forbiddenResponse());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the proper failed validation response for the request.
|
||||
*
|
||||
* @param array $errors
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function response(array $errors)
|
||||
{
|
||||
if ($this->ajax() || $this->wantsJson())
|
||||
{
|
||||
return new JsonResponse($errors, 422);
|
||||
}
|
||||
|
||||
return $this->redirector->to($this->getRedirectUrl())
|
||||
->withInput($this->except($this->dontFlash))
|
||||
->withErrors($errors, $this->errorBag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the response for a forbidden operation.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function forbiddenResponse()
|
||||
{
|
||||
return new Response('Forbidden', 403);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the errors from the given Validator instance.
|
||||
*
|
||||
* @param \Illuminate\Validation\Validator $validator
|
||||
* @return array
|
||||
*/
|
||||
protected function formatErrors(Validator $validator)
|
||||
{
|
||||
return $validator->errors()->getMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL to redirect to on a validation error.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRedirectUrl()
|
||||
{
|
||||
$url = $this->redirector->getUrlGenerator();
|
||||
|
||||
if ($this->redirect)
|
||||
{
|
||||
return $url->to($this->redirect);
|
||||
}
|
||||
elseif ($this->redirectRoute)
|
||||
{
|
||||
return $url->route($this->redirectRoute);
|
||||
}
|
||||
elseif ($this->redirectAction)
|
||||
{
|
||||
return $url->action($this->redirectAction);
|
||||
}
|
||||
|
||||
return $url->previous();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Redirector instance.
|
||||
*
|
||||
* @param \Illuminate\Routing\Redirector $redirector
|
||||
* @return \Illuminate\Foundation\Http\FormRequest
|
||||
*/
|
||||
public function setRedirector(Redirector $redirector)
|
||||
{
|
||||
$this->redirector = $redirector;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the container implementation.
|
||||
*
|
||||
* @param \Illuminate\Container\Container $container
|
||||
* @return $this
|
||||
*/
|
||||
public function setContainer(Container $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom messages for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set custom attributes for validator errors.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function attributes()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
}
|
||||
261
vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
vendored
Normal file
261
vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php
vendored
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php namespace Illuminate\Foundation\Http;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Pipeline\Pipeline;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\TerminableMiddleware;
|
||||
use Illuminate\Contracts\Http\Kernel as KernelContract;
|
||||
|
||||
class Kernel implements KernelContract {
|
||||
|
||||
/**
|
||||
* The application implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The router instance.
|
||||
*
|
||||
* @var \Illuminate\Routing\Router
|
||||
*/
|
||||
protected $router;
|
||||
|
||||
/**
|
||||
* The bootstrap classes for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bootstrappers = [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'Illuminate\Foundation\Bootstrap\ConfigureLogging',
|
||||
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||
'Illuminate\Foundation\Bootstrap\BootProviders',
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's middleware stack.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [];
|
||||
|
||||
/**
|
||||
* Create a new HTTP kernel instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Application $app, Router $router)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->router = $router;
|
||||
|
||||
foreach ($this->routeMiddleware as $key => $middleware)
|
||||
{
|
||||
$router->middleware($key, $middleware);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming HTTP request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function handle($request)
|
||||
{
|
||||
try
|
||||
{
|
||||
$response = $this->sendRequestThroughRouter($request);
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$this->reportException($e);
|
||||
|
||||
$response = $this->renderException($request, $e);
|
||||
}
|
||||
|
||||
$this->app['events']->fire('kernel.handled', [$request, $response]);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the given request through the middleware / router.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function sendRequestThroughRouter($request)
|
||||
{
|
||||
$this->app->instance('request', $request);
|
||||
|
||||
Facade::clearResolvedInstance('request');
|
||||
|
||||
$this->bootstrap();
|
||||
|
||||
return (new Pipeline($this->app))
|
||||
->send($request)
|
||||
->through($this->middleware)
|
||||
->then($this->dispatchToRouter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the terminate method on any terminable middleware.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Response $response
|
||||
* @return void
|
||||
*/
|
||||
public function terminate($request, $response)
|
||||
{
|
||||
$routeMiddlewares = $this->gatherRouteMiddlewares($request);
|
||||
|
||||
foreach (array_merge($routeMiddlewares, $this->middleware) as $middleware)
|
||||
{
|
||||
$instance = $this->app->make($middleware);
|
||||
|
||||
if ($instance instanceof TerminableMiddleware)
|
||||
{
|
||||
$instance->terminate($request, $response);
|
||||
}
|
||||
}
|
||||
|
||||
$this->app->terminate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gather the route middleware for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
protected function gatherRouteMiddlewares($request)
|
||||
{
|
||||
if ($request->route())
|
||||
{
|
||||
return $this->router->gatherRouteMiddlewares($request->route());
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new middleware to beginning of the stack if it does not already exist.
|
||||
*
|
||||
* @param string $middleware
|
||||
* @return $this
|
||||
*/
|
||||
public function prependMiddleware($middleware)
|
||||
{
|
||||
if (array_search($middleware, $this->middleware) === false)
|
||||
{
|
||||
array_unshift($this->middleware, $middleware);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new middleware to end of the stack if it does not already exist.
|
||||
*
|
||||
* @param string $middleware
|
||||
* @return $this
|
||||
*/
|
||||
public function pushMiddleware($middleware)
|
||||
{
|
||||
if (array_search($middleware, $this->middleware) === false)
|
||||
{
|
||||
$this->middleware[] = $middleware;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the application for HTTP requests.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function bootstrap()
|
||||
{
|
||||
if ( ! $this->app->hasBeenBootstrapped())
|
||||
{
|
||||
$this->app->bootstrapWith($this->bootstrappers());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the route dispatcher callback.
|
||||
*
|
||||
* @return \Closure
|
||||
*/
|
||||
protected function dispatchToRouter()
|
||||
{
|
||||
return function($request)
|
||||
{
|
||||
$this->app->instance('request', $request);
|
||||
|
||||
return $this->router->dispatch($request);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bootstrap classes for the application.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function bootstrappers()
|
||||
{
|
||||
return $this->bootstrappers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the exception to the exception handler.
|
||||
*
|
||||
* @param \Exception $e
|
||||
* @return void
|
||||
*/
|
||||
protected function reportException(Exception $e)
|
||||
{
|
||||
$this->app['Illuminate\Contracts\Debug\ExceptionHandler']->report($e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the exception to a response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Exception $e
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
protected function renderException($request, Exception $e)
|
||||
{
|
||||
return $this->app['Illuminate\Contracts\Debug\ExceptionHandler']->render($request, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Laravel application instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public function getApplication()
|
||||
{
|
||||
return $this->app;
|
||||
}
|
||||
|
||||
}
|
||||
45
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php
vendored
Normal file
45
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php namespace Illuminate\Foundation\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Routing\Middleware;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class CheckForMaintenanceMode implements Middleware {
|
||||
|
||||
/**
|
||||
* The application implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->app->isDownForMaintenance())
|
||||
{
|
||||
throw new HttpException(503);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
}
|
||||
94
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
vendored
Normal file
94
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php namespace Illuminate\Foundation\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Routing\Middleware;
|
||||
use Symfony\Component\HttpFoundation\Cookie;
|
||||
use Illuminate\Contracts\Encryption\Encrypter;
|
||||
use Illuminate\Session\TokenMismatchException;
|
||||
use Symfony\Component\Security\Core\Util\StringUtils;
|
||||
|
||||
class VerifyCsrfToken implements Middleware {
|
||||
|
||||
/**
|
||||
* The encrypter implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Encryption\Encrypter
|
||||
*/
|
||||
protected $encrypter;
|
||||
|
||||
/**
|
||||
* Create a new middleware instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Encrypter $encrypter)
|
||||
{
|
||||
$this->encrypter = $encrypter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Illuminate\Session\TokenMismatchException
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($this->isReading($request) || $this->tokensMatch($request))
|
||||
{
|
||||
return $this->addCookieToResponse($request, $next($request));
|
||||
}
|
||||
|
||||
throw new TokenMismatchException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the session and input CSRF tokens match.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
protected function tokensMatch($request)
|
||||
{
|
||||
$token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
|
||||
|
||||
if ( ! $token && $header = $request->header('X-XSRF-TOKEN'))
|
||||
{
|
||||
$token = $this->encrypter->decrypt($header);
|
||||
}
|
||||
|
||||
return StringUtils::equals($request->session()->token(), $token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the CSRF token to the response cookies.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Http\Response $response
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function addCookieToResponse($request, $response)
|
||||
{
|
||||
$response->headers->setCookie(
|
||||
new Cookie('XSRF-TOKEN', $request->session()->token(), time() + 60 * 120, '/', null, false, false)
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the HTTP request uses a ‘read’ verb.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
protected function isReading($request)
|
||||
{
|
||||
return in_array($request->method(), ['HEAD', 'GET', 'OPTIONS']);
|
||||
}
|
||||
|
||||
}
|
||||
53
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php
vendored
Normal file
53
vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyPostSize.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php namespace Illuminate\Foundation\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Routing\Middleware;
|
||||
use Illuminate\Http\Exception\PostTooLargeException;
|
||||
|
||||
class VerifyPostSize implements Middleware {
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Illuminate\Http\Exception\PostTooLargeException
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->server('CONTENT_LENGTH') > $this->getPostMaxSize())
|
||||
{
|
||||
throw new PostTooLargeException;
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the server 'post_max_size' as bytes.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getPostMaxSize()
|
||||
{
|
||||
$postMaxSize = ini_get('post_max_size');
|
||||
|
||||
switch (substr($postMaxSize, -1))
|
||||
{
|
||||
case 'M':
|
||||
case 'm':
|
||||
return (int) $postMaxSize * 1048576;
|
||||
case 'K':
|
||||
case 'k':
|
||||
return (int) $postMaxSize * 1024;
|
||||
case 'G':
|
||||
case 'g':
|
||||
return (int) $postMaxSize * 1073741824;
|
||||
}
|
||||
|
||||
return (int) $postMaxSize;
|
||||
}
|
||||
|
||||
}
|
||||
28
vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php
vendored
Normal file
28
vendor/laravel/framework/src/Illuminate/Foundation/Inspiring.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php namespace Illuminate\Foundation;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class Inspiring {
|
||||
|
||||
/**
|
||||
* Get an inspiring quote.
|
||||
*
|
||||
* Taylor & Dayle made this commit from Jungfraujoch. (11,333 ft.)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function quote()
|
||||
{
|
||||
return Collection::make([
|
||||
|
||||
'When there is no desire, all things are at peace. - Laozi',
|
||||
'Simplicity is the ultimate sophistication. - Leonardo da Vinci',
|
||||
'Simplicity is the essence of happiness. - Cedric Bledsoe',
|
||||
'Smile, breathe, and go slowly. - Thich Nhat Hanh',
|
||||
'Simplicity is an acquired taste. - Katharine Gerould',
|
||||
'Well begun is half done. - Aristotle',
|
||||
|
||||
])->random();
|
||||
}
|
||||
|
||||
}
|
||||
209
vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php
vendored
Normal file
209
vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
<?php namespace Illuminate\Foundation;
|
||||
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
|
||||
|
||||
class ProviderRepository {
|
||||
|
||||
/**
|
||||
* The application implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The filesystem instance.
|
||||
*
|
||||
* @var \Illuminate\Filesystem\Filesystem
|
||||
*/
|
||||
protected $files;
|
||||
|
||||
/**
|
||||
* The path to the manifest file.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $manifestPath;
|
||||
|
||||
/**
|
||||
* Create a new service repository instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Filesystem\Filesystem $files
|
||||
* @param string $manifestPath
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ApplicationContract $app, Filesystem $files, $manifestPath)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->files = $files;
|
||||
$this->manifestPath = $manifestPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application service providers.
|
||||
*
|
||||
* @param array $providers
|
||||
* @return void
|
||||
*/
|
||||
public function load(array $providers)
|
||||
{
|
||||
$manifest = $this->loadManifest();
|
||||
|
||||
// First we will load the service manifest, which contains information on all
|
||||
// service providers registered with the application and which services it
|
||||
// provides. This is used to know which services are "deferred" loaders.
|
||||
if ($this->shouldRecompile($manifest, $providers))
|
||||
{
|
||||
$manifest = $this->compileManifest($providers);
|
||||
}
|
||||
|
||||
// Next, we will register events to load the providers for each of the events
|
||||
// that it has requested. This allows the service provider to defer itself
|
||||
// while still getting automatically loaded when a certain event occurs.
|
||||
foreach ($manifest['when'] as $provider => $events)
|
||||
{
|
||||
$this->registerLoadEvents($provider, $events);
|
||||
}
|
||||
|
||||
// We will go ahead and register all of the eagerly loaded providers with the
|
||||
// application so their services can be registered with the application as
|
||||
// a provided service. Then we will set the deferred service list on it.
|
||||
foreach ($manifest['eager'] as $provider)
|
||||
{
|
||||
$this->app->register($this->createProvider($provider));
|
||||
}
|
||||
|
||||
$this->app->setDeferredServices($manifest['deferred']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the load events for the given provider.
|
||||
*
|
||||
* @param string $provider
|
||||
* @param array $events
|
||||
* @return void
|
||||
*/
|
||||
protected function registerLoadEvents($provider, array $events)
|
||||
{
|
||||
if (count($events) < 1) return;
|
||||
|
||||
$app = $this->app;
|
||||
|
||||
$app->make('events')->listen($events, function() use ($app, $provider)
|
||||
{
|
||||
$app->register($provider);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the application manifest file.
|
||||
*
|
||||
* @param array $providers
|
||||
* @return array
|
||||
*/
|
||||
protected function compileManifest($providers)
|
||||
{
|
||||
// The service manifest should contain a list of all of the providers for
|
||||
// the application so we can compare it on each request to the service
|
||||
// and determine if the manifest should be recompiled or is current.
|
||||
$manifest = $this->freshManifest($providers);
|
||||
|
||||
foreach ($providers as $provider)
|
||||
{
|
||||
$instance = $this->createProvider($provider);
|
||||
|
||||
// When recompiling the service manifest, we will spin through each of the
|
||||
// providers and check if it's a deferred provider or not. If so we'll
|
||||
// add it's provided services to the manifest and note the provider.
|
||||
if ($instance->isDeferred())
|
||||
{
|
||||
foreach ($instance->provides() as $service)
|
||||
{
|
||||
$manifest['deferred'][$service] = $provider;
|
||||
}
|
||||
|
||||
$manifest['when'][$provider] = $instance->when();
|
||||
}
|
||||
|
||||
// If the service providers are not deferred, we will simply add it to an
|
||||
// array of eagerly loaded providers that will get registered on every
|
||||
// request to this application instead of "lazy" loading every time.
|
||||
else
|
||||
{
|
||||
$manifest['eager'][] = $provider;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->writeManifest($manifest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new provider instance.
|
||||
*
|
||||
* @param string $provider
|
||||
* @return \Illuminate\Support\ServiceProvider
|
||||
*/
|
||||
public function createProvider($provider)
|
||||
{
|
||||
return new $provider($this->app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the manifest should be compiled.
|
||||
*
|
||||
* @param array $manifest
|
||||
* @param array $providers
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldRecompile($manifest, $providers)
|
||||
{
|
||||
return is_null($manifest) || $manifest['providers'] != $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the service provider manifest JSON file.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function loadManifest()
|
||||
{
|
||||
// The service manifest is a file containing a JSON representation of every
|
||||
// service provided by the application and whether its provider is using
|
||||
// deferred loading or should be eagerly loaded on each request to us.
|
||||
if ($this->files->exists($this->manifestPath))
|
||||
{
|
||||
$manifest = json_decode($this->files->get($this->manifestPath), true);
|
||||
|
||||
return array_merge(['when' => []], $manifest);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the service manifest file to disk.
|
||||
*
|
||||
* @param array $manifest
|
||||
* @return array
|
||||
*/
|
||||
public function writeManifest($manifest)
|
||||
{
|
||||
$this->files->put(
|
||||
$this->manifestPath, json_encode($manifest, JSON_PRETTY_PRINT)
|
||||
);
|
||||
|
||||
return $manifest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a fresh service manifest data structure.
|
||||
*
|
||||
* @param array $providers
|
||||
* @return array
|
||||
*/
|
||||
protected function freshManifest(array $providers)
|
||||
{
|
||||
return ['providers' => $providers, 'eager' => [], 'deferred' => []];
|
||||
}
|
||||
|
||||
}
|
||||
424
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
vendored
Normal file
424
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php
vendored
Normal file
@@ -0,0 +1,424 @@
|
||||
<?php namespace Illuminate\Foundation\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\Console\UpCommand;
|
||||
use Illuminate\Foundation\Console\DownCommand;
|
||||
use Illuminate\Foundation\Console\FreshCommand;
|
||||
use Illuminate\Foundation\Console\ServeCommand;
|
||||
use Illuminate\Foundation\Console\TinkerCommand;
|
||||
use Illuminate\Foundation\Console\AppNameCommand;
|
||||
use Illuminate\Foundation\Console\OptimizeCommand;
|
||||
use Illuminate\Foundation\Console\RouteListCommand;
|
||||
use Illuminate\Foundation\Console\EventMakeCommand;
|
||||
use Illuminate\Foundation\Console\ModelMakeCommand;
|
||||
use Illuminate\Foundation\Console\RouteCacheCommand;
|
||||
use Illuminate\Foundation\Console\RouteClearCommand;
|
||||
use Illuminate\Foundation\Console\CommandMakeCommand;
|
||||
use Illuminate\Foundation\Console\ConfigCacheCommand;
|
||||
use Illuminate\Foundation\Console\ConfigClearCommand;
|
||||
use Illuminate\Foundation\Console\ConsoleMakeCommand;
|
||||
use Illuminate\Foundation\Console\EnvironmentCommand;
|
||||
use Illuminate\Foundation\Console\KeyGenerateCommand;
|
||||
use Illuminate\Foundation\Console\RequestMakeCommand;
|
||||
use Illuminate\Foundation\Console\ProviderMakeCommand;
|
||||
use Illuminate\Foundation\Console\HandlerEventCommand;
|
||||
use Illuminate\Foundation\Console\ClearCompiledCommand;
|
||||
use Illuminate\Foundation\Console\EventGenerateCommand;
|
||||
use Illuminate\Foundation\Console\VendorPublishCommand;
|
||||
use Illuminate\Foundation\Console\HandlerCommandCommand;
|
||||
|
||||
class ArtisanServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* The commands to be registered.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
'AppName' => 'command.app.name',
|
||||
'ClearCompiled' => 'command.clear-compiled',
|
||||
'CommandMake' => 'command.command.make',
|
||||
'ConfigCache' => 'command.config.cache',
|
||||
'ConfigClear' => 'command.config.clear',
|
||||
'ConsoleMake' => 'command.console.make',
|
||||
'EventGenerate' => 'command.event.generate',
|
||||
'EventMake' => 'command.event.make',
|
||||
'Down' => 'command.down',
|
||||
'Environment' => 'command.environment',
|
||||
'Fresh' => 'command.fresh',
|
||||
'HandlerCommand' => 'command.handler.command',
|
||||
'HandlerEvent' => 'command.handler.event',
|
||||
'KeyGenerate' => 'command.key.generate',
|
||||
'ModelMake' => 'command.model.make',
|
||||
'Optimize' => 'command.optimize',
|
||||
'ProviderMake' => 'command.provider.make',
|
||||
'RequestMake' => 'command.request.make',
|
||||
'RouteCache' => 'command.route.cache',
|
||||
'RouteClear' => 'command.route.clear',
|
||||
'RouteList' => 'command.route.list',
|
||||
'Serve' => 'command.serve',
|
||||
'Tinker' => 'command.tinker',
|
||||
'Up' => 'command.up',
|
||||
'VendorPublish' => 'command.vendor.publish',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
foreach (array_keys($this->commands) as $command)
|
||||
{
|
||||
$method = "register{$command}Command";
|
||||
|
||||
call_user_func_array([$this, $method], []);
|
||||
}
|
||||
|
||||
$this->commands(array_values($this->commands));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerAppNameCommand()
|
||||
{
|
||||
$this->app->singleton('command.app.name', function($app)
|
||||
{
|
||||
return new AppNameCommand($app['composer'], $app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerClearCompiledCommand()
|
||||
{
|
||||
$this->app->singleton('command.clear-compiled', function()
|
||||
{
|
||||
return new ClearCompiledCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerCommandMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.command.make', function($app)
|
||||
{
|
||||
return new CommandMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfigCacheCommand()
|
||||
{
|
||||
$this->app->singleton('command.config.cache', function($app)
|
||||
{
|
||||
return new ConfigCacheCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfigClearCommand()
|
||||
{
|
||||
$this->app->singleton('command.config.clear', function($app)
|
||||
{
|
||||
return new ConfigClearCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConsoleMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.console.make', function($app)
|
||||
{
|
||||
return new ConsoleMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerEventGenerateCommand()
|
||||
{
|
||||
$this->app->singleton('command.event.generate', function()
|
||||
{
|
||||
return new EventGenerateCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerEventMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.event.make', function($app)
|
||||
{
|
||||
return new EventMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerDownCommand()
|
||||
{
|
||||
$this->app->singleton('command.down', function()
|
||||
{
|
||||
return new DownCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerEnvironmentCommand()
|
||||
{
|
||||
$this->app->singleton('command.environment', function()
|
||||
{
|
||||
return new EnvironmentCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerFreshCommand()
|
||||
{
|
||||
$this->app->singleton('command.fresh', function()
|
||||
{
|
||||
return new FreshCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerHandlerCommandCommand()
|
||||
{
|
||||
$this->app->singleton('command.handler.command', function($app)
|
||||
{
|
||||
return new HandlerCommandCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerHandlerEventCommand()
|
||||
{
|
||||
$this->app->singleton('command.handler.event', function($app)
|
||||
{
|
||||
return new HandlerEventCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerKeyGenerateCommand()
|
||||
{
|
||||
$this->app->singleton('command.key.generate', function()
|
||||
{
|
||||
return new KeyGenerateCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerModelMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.model.make', function($app)
|
||||
{
|
||||
return new ModelMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerOptimizeCommand()
|
||||
{
|
||||
$this->app->singleton('command.optimize', function($app)
|
||||
{
|
||||
return new OptimizeCommand($app['composer']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerProviderMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.provider.make', function($app)
|
||||
{
|
||||
return new ProviderMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerRequestMakeCommand()
|
||||
{
|
||||
$this->app->singleton('command.request.make', function($app)
|
||||
{
|
||||
return new RequestMakeCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerRouteCacheCommand()
|
||||
{
|
||||
$this->app->singleton('command.route.cache', function($app)
|
||||
{
|
||||
return new RouteCacheCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerRouteClearCommand()
|
||||
{
|
||||
$this->app->singleton('command.route.clear', function($app)
|
||||
{
|
||||
return new RouteClearCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerRouteListCommand()
|
||||
{
|
||||
$this->app->singleton('command.route.list', function($app)
|
||||
{
|
||||
return new RouteListCommand($app['router']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerServeCommand()
|
||||
{
|
||||
$this->app->singleton('command.serve', function()
|
||||
{
|
||||
return new ServeCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerTinkerCommand()
|
||||
{
|
||||
$this->app->singleton('command.tinker', function()
|
||||
{
|
||||
return new TinkerCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerUpCommand()
|
||||
{
|
||||
$this->app->singleton('command.up', function()
|
||||
{
|
||||
return new UpCommand;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerVendorPublishCommand()
|
||||
{
|
||||
$this->app->singleton('command.vendor.publish', function($app)
|
||||
{
|
||||
return new VendorPublishCommand($app['files']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array_values($this->commands);
|
||||
}
|
||||
|
||||
}
|
||||
38
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php
vendored
Normal file
38
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ComposerServiceProvider.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php namespace Illuminate\Foundation\Providers;
|
||||
|
||||
use Illuminate\Foundation\Composer;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class ComposerServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('composer', function($app)
|
||||
{
|
||||
return new Composer($app['files'], $app->basePath());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return array('composer');
|
||||
}
|
||||
|
||||
}
|
||||
30
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php
vendored
Normal file
30
vendor/laravel/framework/src/Illuminate/Foundation/Providers/ConsoleSupportServiceProvider.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php namespace Illuminate\Foundation\Providers;
|
||||
|
||||
use Illuminate\Support\AggregateServiceProvider;
|
||||
|
||||
class ConsoleSupportServiceProvider extends AggregateServiceProvider {
|
||||
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = true;
|
||||
|
||||
/**
|
||||
* The provider class names.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $providers = [
|
||||
'Illuminate\Auth\GeneratorServiceProvider',
|
||||
'Illuminate\Console\ScheduleServiceProvider',
|
||||
'Illuminate\Database\MigrationServiceProvider',
|
||||
'Illuminate\Database\SeedServiceProvider',
|
||||
'Illuminate\Foundation\Providers\ComposerServiceProvider',
|
||||
'Illuminate\Queue\ConsoleServiceProvider',
|
||||
'Illuminate\Routing\GeneratorServiceProvider',
|
||||
'Illuminate\Session\CommandsServiceProvider',
|
||||
];
|
||||
|
||||
}
|
||||
66
vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php
vendored
Normal file
66
vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php namespace Illuminate\Foundation\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
class FormRequestServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->app['events']->listen('router.matched', function()
|
||||
{
|
||||
$this->app->resolving(function(FormRequest $request, $app)
|
||||
{
|
||||
$this->initializeRequest($request, $app['request']);
|
||||
|
||||
$request->setContainer($app)
|
||||
->setRedirector($app['Illuminate\Routing\Redirector']);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the form request with data from the given request.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Http\FormRequest $form
|
||||
* @param \Symfony\Component\HttpFoundation\Request $current
|
||||
* @return void
|
||||
*/
|
||||
protected function initializeRequest(FormRequest $form, Request $current)
|
||||
{
|
||||
$files = $current->files->all();
|
||||
|
||||
$files = is_array($files) ? array_filter($files) : $files;
|
||||
|
||||
$form->initialize(
|
||||
$current->query->all(), $current->request->all(), $current->attributes->all(),
|
||||
$current->cookies->all(), $files, $current->server->all(), $current->getContent()
|
||||
);
|
||||
|
||||
if ($session = $current->getSession())
|
||||
{
|
||||
$form->setSession($session);
|
||||
}
|
||||
|
||||
$form->setUserResolver($current->getUserResolver());
|
||||
|
||||
$form->setRouteResolver($current->getRouteResolver());
|
||||
}
|
||||
|
||||
}
|
||||
16
vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php
vendored
Normal file
16
vendor/laravel/framework/src/Illuminate/Foundation/Providers/FoundationServiceProvider.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php namespace Illuminate\Foundation\Providers;
|
||||
|
||||
use Illuminate\Support\AggregateServiceProvider;
|
||||
|
||||
class FoundationServiceProvider extends AggregateServiceProvider {
|
||||
|
||||
/**
|
||||
* The provider class names.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $providers = [
|
||||
'Illuminate\Foundation\Providers\FormRequestServiceProvider',
|
||||
];
|
||||
|
||||
}
|
||||
62
vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php
vendored
Normal file
62
vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/EventServiceProvider.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php namespace Illuminate\Foundation\Support\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* The event handler mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $listen = [];
|
||||
|
||||
/**
|
||||
* The subscriber classes to register.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $subscribe = [];
|
||||
|
||||
/**
|
||||
* Register the application's event listeners.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Events\Dispatcher $events
|
||||
* @return void
|
||||
*/
|
||||
public function boot(DispatcherContract $events)
|
||||
{
|
||||
foreach ($this->listen as $event => $listeners)
|
||||
{
|
||||
foreach ($listeners as $listener)
|
||||
{
|
||||
$events->listen($event, $listener);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->subscribe as $subscriber)
|
||||
{
|
||||
$events->subscribe($subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the events and handlers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function listens()
|
||||
{
|
||||
return $this->listen;
|
||||
}
|
||||
|
||||
}
|
||||
111
vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php
vendored
Normal file
111
vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
<?php namespace Illuminate\Foundation\Support\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider {
|
||||
|
||||
/**
|
||||
* The controller namespace for the application.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $namespace;
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @param \Illuminate\Routing\Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function boot(Router $router)
|
||||
{
|
||||
$this->setRootControllerNamespace();
|
||||
|
||||
if ($this->app->routesAreCached())
|
||||
{
|
||||
$this->loadCachedRoutes();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->loadRoutes();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the root controller namespace for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setRootControllerNamespace()
|
||||
{
|
||||
if (is_null($this->namespace)) return;
|
||||
|
||||
$this->app['Illuminate\Contracts\Routing\UrlGenerator']
|
||||
->setRootControllerNamespace($this->namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the cached routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function loadCachedRoutes()
|
||||
{
|
||||
$this->app->booted(function()
|
||||
{
|
||||
require $this->app->getCachedRoutesPath();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the application routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function loadRoutes()
|
||||
{
|
||||
$this->app->call([$this, 'map']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the standard routes file for the application.
|
||||
*
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
protected function loadRoutesFrom($path)
|
||||
{
|
||||
$router = $this->app['Illuminate\Routing\Router'];
|
||||
|
||||
if (is_null($this->namespace)) return require $path;
|
||||
|
||||
$router->group(['namespace' => $this->namespace], function($router) use ($path)
|
||||
{
|
||||
require $path;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass dynamic methods onto the router instance.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
return call_user_func_array([$this->app['router'], $method], $parameters);
|
||||
}
|
||||
|
||||
}
|
||||
195
vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php
vendored
Normal file
195
vendor/laravel/framework/src/Illuminate/Foundation/Testing/ApplicationTrait.php
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php namespace Illuminate\Foundation\Testing;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Contracts\Auth\Authenticatable as UserContract;
|
||||
|
||||
trait ApplicationTrait {
|
||||
|
||||
/**
|
||||
* The Illuminate application instance.
|
||||
*
|
||||
* @var \Illuminate\Foundation\Application
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* The last response returned by the application.
|
||||
*
|
||||
* @var \Illuminate\Http\Response
|
||||
*/
|
||||
protected $response;
|
||||
|
||||
/**
|
||||
* The last code returned by artisan cli.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $code;
|
||||
|
||||
/**
|
||||
* Refresh the application instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function refreshApplication()
|
||||
{
|
||||
putenv('APP_ENV=testing');
|
||||
|
||||
$this->app = $this->createApplication();
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the given URI and return the Response.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $uri
|
||||
* @param array $parameters
|
||||
* @param array $cookies
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @param string $content
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
|
||||
{
|
||||
$request = Request::create($uri, $method, $parameters, $cookies, $files, $server, $content);
|
||||
|
||||
return $this->response = $this->app->make('Illuminate\Contracts\Http\Kernel')->handle($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the given HTTPS URI and return the Response.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $uri
|
||||
* @param array $parameters
|
||||
* @param array $cookies
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @param string $content
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function callSecure($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
|
||||
{
|
||||
$uri = 'https://localhost/'.ltrim($uri, '/');
|
||||
|
||||
return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a controller action and return the Response.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $action
|
||||
* @param array $wildcards
|
||||
* @param array $parameters
|
||||
* @param array $cookies
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @param string $content
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function action($method, $action, $wildcards = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
|
||||
{
|
||||
$uri = $this->app['url']->action($action, $wildcards, true);
|
||||
|
||||
return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a named route and return the Response.
|
||||
*
|
||||
* @param string $method
|
||||
* @param string $name
|
||||
* @param array $routeParameters
|
||||
* @param array $parameters
|
||||
* @param array $cookies
|
||||
* @param array $files
|
||||
* @param array $server
|
||||
* @param string $content
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function route($method, $name, $routeParameters = [], $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
|
||||
{
|
||||
$uri = $this->app['url']->route($name, $routeParameters);
|
||||
|
||||
return $this->response = $this->call($method, $uri, $parameters, $cookies, $files, $server, $content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the session to the given array.
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function session(array $data)
|
||||
{
|
||||
$this->startSession();
|
||||
|
||||
foreach ($data as $key => $value)
|
||||
{
|
||||
$this->app['session']->put($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush all of the current session data.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function flushSession()
|
||||
{
|
||||
$this->startSession();
|
||||
|
||||
$this->app['session']->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the session for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function startSession()
|
||||
{
|
||||
if ( ! $this->app['session']->isStarted())
|
||||
{
|
||||
$this->app['session']->start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the currently logged in user for the application.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Authenticatable $user
|
||||
* @param string $driver
|
||||
* @return void
|
||||
*/
|
||||
public function be(UserContract $user, $driver = null)
|
||||
{
|
||||
$this->app['auth']->driver($driver)->setUser($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed a given database connection.
|
||||
*
|
||||
* @param string $class
|
||||
* @return void
|
||||
*/
|
||||
public function seed($class = 'DatabaseSeeder')
|
||||
{
|
||||
$this->artisan('db:seed', ['--class' => $class]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call artisan command and return code.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $parameters
|
||||
* @return int
|
||||
*/
|
||||
public function artisan($command, $parameters = [])
|
||||
{
|
||||
return $this->code = $this->app['Illuminate\Contracts\Console\Kernel']->call($command, $parameters);
|
||||
}
|
||||
|
||||
}
|
||||
218
vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php
vendored
Normal file
218
vendor/laravel/framework/src/Illuminate/Foundation/Testing/AssertionsTrait.php
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php namespace Illuminate\Foundation\Testing;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use PHPUnit_Framework_Assert as PHPUnit;
|
||||
|
||||
trait AssertionsTrait {
|
||||
|
||||
/**
|
||||
* Assert that the client response has an OK status code.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertResponseOk()
|
||||
{
|
||||
$actual = $this->response->getStatusCode();
|
||||
|
||||
return PHPUnit::assertTrue($this->response->isOk(), "Expected status code 200, got {$actual}.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the client response has a given code.
|
||||
*
|
||||
* @param int $code
|
||||
* @return void
|
||||
*/
|
||||
public function assertResponseStatus($code)
|
||||
{
|
||||
$actual = $this->response->getStatusCode();
|
||||
|
||||
return PHPUnit::assertEquals($code, $this->response->getStatusCode(), "Expected status code {$code}, got {$actual}.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the response view has a given piece of bound data.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function assertViewHas($key, $value = null)
|
||||
{
|
||||
if (is_array($key)) return $this->assertViewHasAll($key);
|
||||
|
||||
if ( ! isset($this->response->original) || ! $this->response->original instanceof View)
|
||||
{
|
||||
return PHPUnit::assertTrue(false, 'The response was not a view.');
|
||||
}
|
||||
|
||||
if (is_null($value))
|
||||
{
|
||||
PHPUnit::assertArrayHasKey($key, $this->response->original->getData());
|
||||
}
|
||||
else
|
||||
{
|
||||
PHPUnit::assertEquals($value, $this->response->original->$key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the view has a given list of bound data.
|
||||
*
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
*/
|
||||
public function assertViewHasAll(array $bindings)
|
||||
{
|
||||
foreach ($bindings as $key => $value)
|
||||
{
|
||||
if (is_int($key))
|
||||
{
|
||||
$this->assertViewHas($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertViewHas($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the response view is missing a piece of bound data.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function assertViewMissing($key)
|
||||
{
|
||||
if ( ! isset($this->response->original) || ! $this->response->original instanceof View)
|
||||
{
|
||||
return PHPUnit::assertTrue(false, 'The response was not a view.');
|
||||
}
|
||||
|
||||
PHPUnit::assertArrayNotHasKey($key, $this->response->original->getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert whether the client was redirected to a given URI.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param array $with
|
||||
* @return void
|
||||
*/
|
||||
public function assertRedirectedTo($uri, $with = array())
|
||||
{
|
||||
PHPUnit::assertInstanceOf('Illuminate\Http\RedirectResponse', $this->response);
|
||||
|
||||
PHPUnit::assertEquals($this->app['url']->to($uri), $this->response->headers->get('Location'));
|
||||
|
||||
$this->assertSessionHasAll($with);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert whether the client was redirected to a given route.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param array $with
|
||||
* @return void
|
||||
*/
|
||||
public function assertRedirectedToRoute($name, $parameters = array(), $with = array())
|
||||
{
|
||||
$this->assertRedirectedTo($this->app['url']->route($name, $parameters), $with);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert whether the client was redirected to a given action.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param array $with
|
||||
* @return void
|
||||
*/
|
||||
public function assertRedirectedToAction($name, $parameters = array(), $with = array())
|
||||
{
|
||||
$this->assertRedirectedTo($this->app['url']->action($name, $parameters), $with);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the session has a given list of values.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function assertSessionHas($key, $value = null)
|
||||
{
|
||||
if (is_array($key)) return $this->assertSessionHasAll($key);
|
||||
|
||||
if (is_null($value))
|
||||
{
|
||||
PHPUnit::assertTrue($this->app['session.store']->has($key), "Session missing key: $key");
|
||||
}
|
||||
else
|
||||
{
|
||||
PHPUnit::assertEquals($value, $this->app['session.store']->get($key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the session has a given list of values.
|
||||
*
|
||||
* @param array $bindings
|
||||
* @return void
|
||||
*/
|
||||
public function assertSessionHasAll(array $bindings)
|
||||
{
|
||||
foreach ($bindings as $key => $value)
|
||||
{
|
||||
if (is_int($key))
|
||||
{
|
||||
$this->assertSessionHas($value);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->assertSessionHas($key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the session has errors bound.
|
||||
*
|
||||
* @param string|array $bindings
|
||||
* @param mixed $format
|
||||
* @return void
|
||||
*/
|
||||
public function assertSessionHasErrors($bindings = array(), $format = null)
|
||||
{
|
||||
$this->assertSessionHas('errors');
|
||||
|
||||
$bindings = (array) $bindings;
|
||||
|
||||
$errors = $this->app['session.store']->get('errors');
|
||||
|
||||
foreach ($bindings as $key => $value)
|
||||
{
|
||||
if (is_int($key))
|
||||
{
|
||||
PHPUnit::assertTrue($errors->has($value), "Session missing error: $value");
|
||||
}
|
||||
else
|
||||
{
|
||||
PHPUnit::assertContains($value, $errors->get($key, $format));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the session has old input.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function assertHasOldInput()
|
||||
{
|
||||
$this->assertSessionHas('_old_input');
|
||||
}
|
||||
|
||||
}
|
||||
44
vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php
vendored
Normal file
44
vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestCase.php
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php namespace Illuminate\Foundation\Testing;
|
||||
|
||||
use PHPUnit_Framework_TestCase;
|
||||
|
||||
abstract class TestCase extends PHPUnit_Framework_TestCase {
|
||||
|
||||
use ApplicationTrait, AssertionsTrait;
|
||||
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* Needs to be implemented by subclasses.
|
||||
*
|
||||
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
|
||||
*/
|
||||
abstract public function createApplication();
|
||||
|
||||
/**
|
||||
* Setup the test environment.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
if ( ! $this->app)
|
||||
{
|
||||
$this->refreshApplication();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up the testing environment before the next test.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function tearDown()
|
||||
{
|
||||
if ($this->app)
|
||||
{
|
||||
$this->app->flush();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
102
vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php
vendored
Normal file
102
vendor/laravel/framework/src/Illuminate/Foundation/Validation/ValidatesRequests.php
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php namespace Illuminate\Foundation\Validation;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Validation\Validator;
|
||||
use Illuminate\Http\Exception\HttpResponseException;
|
||||
|
||||
trait ValidatesRequests {
|
||||
|
||||
/**
|
||||
* Validate the given request with the given rules.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param array $rules
|
||||
* @param array $messages
|
||||
* @return void
|
||||
*/
|
||||
public function validate(Request $request, array $rules, array $messages = array())
|
||||
{
|
||||
$validator = $this->getValidationFactory()->make($request->all(), $rules, $messages);
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
$this->throwValidationException($request, $validator);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw the failed validation exception.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Illuminate\Contracts\Validation\Validator $validator
|
||||
* @return void
|
||||
*/
|
||||
protected function throwValidationException(Request $request, $validator)
|
||||
{
|
||||
throw new HttpResponseException($this->buildFailedValidationResponse(
|
||||
$request, $this->formatValidationErrors($validator)
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the response for when a request fails validation.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param array $errors
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function buildFailedValidationResponse(Request $request, array $errors)
|
||||
{
|
||||
if ($request->ajax() || $request->wantsJson())
|
||||
{
|
||||
return new JsonResponse($errors, 422);
|
||||
}
|
||||
|
||||
return redirect()->to($this->getRedirectUrl())
|
||||
->withInput($request->input())
|
||||
->withErrors($errors, $this->errorBag());
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the validation errors to be returned.
|
||||
*
|
||||
* @param \Illuminate\Validation\Validator $validator
|
||||
* @return array
|
||||
*/
|
||||
protected function formatValidationErrors(Validator $validator)
|
||||
{
|
||||
return $validator->errors()->getMessages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL we should redirect to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRedirectUrl()
|
||||
{
|
||||
return app('Illuminate\Routing\UrlGenerator')->previous();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validation factory instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Validation\Factory
|
||||
*/
|
||||
protected function getValidationFactory()
|
||||
{
|
||||
return app('Illuminate\Contracts\Validation\Factory');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the key to be used for the view error bag.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function errorBag()
|
||||
{
|
||||
return 'default';
|
||||
}
|
||||
|
||||
}
|
||||
678
vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
vendored
Normal file
678
vendor/laravel/framework/src/Illuminate/Foundation/helpers.php
vendored
Normal file
@@ -0,0 +1,678 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
if ( ! function_exists('abort'))
|
||||
{
|
||||
/**
|
||||
* Throw an HttpException with the given data.
|
||||
*
|
||||
* @param int $code
|
||||
* @param string $message
|
||||
* @param array $headers
|
||||
* @return void
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
function abort($code, $message = '', array $headers = array())
|
||||
{
|
||||
return app()->abort($code, $message, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('action'))
|
||||
{
|
||||
/**
|
||||
* Generate a URL to a controller action.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @return string
|
||||
*/
|
||||
function action($name, $parameters = array())
|
||||
{
|
||||
return app('url')->action($name, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('app'))
|
||||
{
|
||||
/**
|
||||
* Get the available container instance.
|
||||
*
|
||||
* @param string $make
|
||||
* @param array $parameters
|
||||
* @return mixed|\Illuminate\Foundation\Application
|
||||
*/
|
||||
function app($make = null, $parameters = [])
|
||||
{
|
||||
if (is_null($make)) return Container::getInstance();
|
||||
|
||||
return Container::getInstance()->make($make, $parameters);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('app_path'))
|
||||
{
|
||||
/**
|
||||
* Get the path to the application folder.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function app_path($path = '')
|
||||
{
|
||||
return app('path').($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('asset'))
|
||||
{
|
||||
/**
|
||||
* Generate an asset path for the application.
|
||||
*
|
||||
* @param string $path
|
||||
* @param bool $secure
|
||||
* @return string
|
||||
*/
|
||||
function asset($path, $secure = null)
|
||||
{
|
||||
return app('url')->asset($path, $secure);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('auth'))
|
||||
{
|
||||
/**
|
||||
* Get the available auth instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Auth\Guard
|
||||
*/
|
||||
function auth()
|
||||
{
|
||||
return app('Illuminate\Contracts\Auth\Guard');
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('base_path'))
|
||||
{
|
||||
/**
|
||||
* Get the path to the base of the install.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function base_path($path = '')
|
||||
{
|
||||
return app()->basePath().($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('back'))
|
||||
{
|
||||
/**
|
||||
* Create a new redirect response to the previous location.
|
||||
*
|
||||
* @param int $status
|
||||
* @param array $headers
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
function back($status = 302, $headers = array())
|
||||
{
|
||||
return app('redirect')->back($status, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('bcrypt'))
|
||||
{
|
||||
/**
|
||||
* Hash the given value.
|
||||
*
|
||||
* @param string $value
|
||||
* @param array $options
|
||||
* @return string
|
||||
*/
|
||||
function bcrypt($value, $options = array())
|
||||
{
|
||||
return app('hash')->make($value, $options);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('config'))
|
||||
{
|
||||
/**
|
||||
* Get / set the specified configuration value.
|
||||
*
|
||||
* If an array is passed as the key, we will assume you want to set an array of values.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function config($key = null, $default = null)
|
||||
{
|
||||
if (is_null($key)) return app('config');
|
||||
|
||||
if (is_array($key))
|
||||
{
|
||||
return app('config')->set($key);
|
||||
}
|
||||
|
||||
return app('config')->get($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('config_path'))
|
||||
{
|
||||
/**
|
||||
* Get the configuration path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function config_path($path = '')
|
||||
{
|
||||
return app()->make('path.config').($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('cookie'))
|
||||
{
|
||||
/**
|
||||
* Create a new cookie instance.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
* @param int $minutes
|
||||
* @param string $path
|
||||
* @param string $domain
|
||||
* @param bool $secure
|
||||
* @param bool $httpOnly
|
||||
* @return \Symfony\Component\HttpFoundation\Cookie
|
||||
*/
|
||||
function cookie($name = null, $value = null, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true)
|
||||
{
|
||||
$cookie = app('Illuminate\Contracts\Cookie\Factory');
|
||||
|
||||
if (is_null($name))
|
||||
{
|
||||
return $cookie;
|
||||
}
|
||||
|
||||
return $cookie->make($name, $value, $minutes, $path, $domain, $secure, $httpOnly);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('csrf_token'))
|
||||
{
|
||||
/**
|
||||
* Get the CSRF token value.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
function csrf_token()
|
||||
{
|
||||
$session = app('session');
|
||||
|
||||
if (isset($session))
|
||||
{
|
||||
return $session->getToken();
|
||||
}
|
||||
|
||||
throw new RuntimeException("Application session store not set.");
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('database_path'))
|
||||
{
|
||||
/**
|
||||
* Get the database path.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function database_path($path = '')
|
||||
{
|
||||
return app()->databasePath().($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('delete'))
|
||||
{
|
||||
/**
|
||||
* Register a new DELETE route with the router.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param \Closure|array|string $action
|
||||
* @return \Illuminate\Routing\Route
|
||||
*/
|
||||
function delete($uri, $action)
|
||||
{
|
||||
return app('router')->delete($uri, $action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('get'))
|
||||
{
|
||||
/**
|
||||
* Register a new GET route with the router.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param \Closure|array|string $action
|
||||
* @return \Illuminate\Routing\Route
|
||||
*/
|
||||
function get($uri, $action)
|
||||
{
|
||||
return app('router')->get($uri, $action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('info'))
|
||||
{
|
||||
/**
|
||||
* Write some information to the log.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
function info($message, $context = array())
|
||||
{
|
||||
return app('log')->info($message, $context);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('logger'))
|
||||
{
|
||||
/**
|
||||
* Log a debug message to the logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
* @return void
|
||||
*/
|
||||
function logger($message = null, array $context = array())
|
||||
{
|
||||
if (is_null($message)) return app('log');
|
||||
|
||||
return app('log')->debug($message, $context);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('old'))
|
||||
{
|
||||
/**
|
||||
* Retrieve an old input item.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function old($key = null, $default = null)
|
||||
{
|
||||
return app('request')->old($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('patch'))
|
||||
{
|
||||
/**
|
||||
* Register a new PATCH route with the router.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param \Closure|array|string $action
|
||||
* @return \Illuminate\Routing\Route
|
||||
*/
|
||||
function patch($uri, $action)
|
||||
{
|
||||
return app('router')->patch($uri, $action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('post'))
|
||||
{
|
||||
/**
|
||||
* Register a new POST route with the router.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param \Closure|array|string $action
|
||||
* @return \Illuminate\Routing\Route
|
||||
*/
|
||||
function post($uri, $action)
|
||||
{
|
||||
return app('router')->post($uri, $action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('put'))
|
||||
{
|
||||
/**
|
||||
* Register a new PUT route with the router.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param \Closure|array|string $action
|
||||
* @return \Illuminate\Routing\Route
|
||||
*/
|
||||
function put($uri, $action)
|
||||
{
|
||||
return app('router')->put($uri, $action);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('public_path'))
|
||||
{
|
||||
/**
|
||||
* Get the path to the public folder.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function public_path($path = '')
|
||||
{
|
||||
return app()->make('path.public').($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('redirect'))
|
||||
{
|
||||
/**
|
||||
* Get an instance of the redirector.
|
||||
*
|
||||
* @param string|null $to
|
||||
* @param int $status
|
||||
* @param array $headers
|
||||
* @param bool $secure
|
||||
* @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
function redirect($to = null, $status = 302, $headers = array(), $secure = null)
|
||||
{
|
||||
if (is_null($to)) return app('redirect');
|
||||
|
||||
return app('redirect')->to($to, $status, $headers, $secure);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('resource'))
|
||||
{
|
||||
/**
|
||||
* Route a resource to a controller.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $controller
|
||||
* @param array $options
|
||||
* @return void
|
||||
*/
|
||||
function resource($name, $controller, array $options = [])
|
||||
{
|
||||
return app('router')->resource($name, $controller, $options);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('response'))
|
||||
{
|
||||
/**
|
||||
* Return a new response from the application.
|
||||
*
|
||||
* @param string $content
|
||||
* @param int $status
|
||||
* @param array $headers
|
||||
* @return \Symfony\Component\HttpFoundation\Response|\Illuminate\Contracts\Routing\ResponseFactory
|
||||
*/
|
||||
function response($content = '', $status = 200, array $headers = array())
|
||||
{
|
||||
$factory = app('Illuminate\Contracts\Routing\ResponseFactory');
|
||||
|
||||
if (func_num_args() === 0)
|
||||
{
|
||||
return $factory;
|
||||
}
|
||||
|
||||
return $factory->make($content, $status, $headers);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('route'))
|
||||
{
|
||||
/**
|
||||
* Generate a URL to a named route.
|
||||
*
|
||||
* @param string $name
|
||||
* @param array $parameters
|
||||
* @param bool $absolute
|
||||
* @param \Illuminate\Routing\Route $route
|
||||
* @return string
|
||||
*/
|
||||
function route($name, $parameters = array(), $absolute = true, $route = null)
|
||||
{
|
||||
return app('url')->route($name, $parameters, $absolute, $route);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('secure_asset'))
|
||||
{
|
||||
/**
|
||||
* Generate an asset path for the application.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function secure_asset($path)
|
||||
{
|
||||
return asset($path, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('secure_url'))
|
||||
{
|
||||
/**
|
||||
* Generate a HTTPS url for the application.
|
||||
*
|
||||
* @param string $path
|
||||
* @param mixed $parameters
|
||||
* @return string
|
||||
*/
|
||||
function secure_url($path, $parameters = array())
|
||||
{
|
||||
return url($path, $parameters, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('session'))
|
||||
{
|
||||
/**
|
||||
* Get / set the specified session value.
|
||||
*
|
||||
* If an array is passed as the key, we will assume you want to set an array of values.
|
||||
*
|
||||
* @param array|string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function session($key = null, $default = null)
|
||||
{
|
||||
if (is_null($key)) return app('session');
|
||||
|
||||
if (is_array($key)) return app('session')->put($key);
|
||||
|
||||
return app('session')->get($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('storage_path'))
|
||||
{
|
||||
/**
|
||||
* Get the path to the storage folder.
|
||||
*
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function storage_path($path = '')
|
||||
{
|
||||
return app('path.storage').($path ? '/'.$path : $path);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('trans'))
|
||||
{
|
||||
/**
|
||||
* Translate the given message.
|
||||
*
|
||||
* @param string $id
|
||||
* @param array $parameters
|
||||
* @param string $domain
|
||||
* @param string $locale
|
||||
* @return string
|
||||
*/
|
||||
function trans($id = null, $parameters = array(), $domain = 'messages', $locale = null)
|
||||
{
|
||||
if (is_null($id)) return app('translator');
|
||||
|
||||
return app('translator')->trans($id, $parameters, $domain, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('trans_choice'))
|
||||
{
|
||||
/**
|
||||
* Translates the given message based on a count.
|
||||
*
|
||||
* @param string $id
|
||||
* @param int $number
|
||||
* @param array $parameters
|
||||
* @param string $domain
|
||||
* @param string $locale
|
||||
* @return string
|
||||
*/
|
||||
function trans_choice($id, $number, array $parameters = array(), $domain = 'messages', $locale = null)
|
||||
{
|
||||
return app('translator')->transChoice($id, $number, $parameters, $domain, $locale);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('url'))
|
||||
{
|
||||
/**
|
||||
* Generate a url for the application.
|
||||
*
|
||||
* @param string $path
|
||||
* @param mixed $parameters
|
||||
* @param bool $secure
|
||||
* @return string
|
||||
*/
|
||||
function url($path = null, $parameters = array(), $secure = null)
|
||||
{
|
||||
return app('Illuminate\Contracts\Routing\UrlGenerator')->to($path, $parameters, $secure);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('view'))
|
||||
{
|
||||
/**
|
||||
* Get the evaluated view contents for the given view.
|
||||
*
|
||||
* @param string $view
|
||||
* @param array $data
|
||||
* @param array $mergeData
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
function view($view = null, $data = array(), $mergeData = array())
|
||||
{
|
||||
$factory = app('Illuminate\Contracts\View\Factory');
|
||||
|
||||
if (func_num_args() === 0)
|
||||
{
|
||||
return $factory;
|
||||
}
|
||||
|
||||
return $factory->make($view, $data, $mergeData);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('env'))
|
||||
{
|
||||
/**
|
||||
* Gets the value of an environment variable. Supports boolean, empty and null.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
function env($key, $default = null)
|
||||
{
|
||||
$value = getenv($key);
|
||||
|
||||
if ($value === false) return value($default);
|
||||
|
||||
switch (strtolower($value))
|
||||
{
|
||||
case 'true':
|
||||
case '(true)':
|
||||
return true;
|
||||
|
||||
case 'false':
|
||||
case '(false)':
|
||||
return false;
|
||||
|
||||
case 'empty':
|
||||
case '(empty)':
|
||||
return '';
|
||||
|
||||
case 'null':
|
||||
case '(null)':
|
||||
return;
|
||||
}
|
||||
|
||||
if (Str::startsWith($value, '"') && Str::endsWith($value, '"'))
|
||||
{
|
||||
return substr($value, 1, -1);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('event'))
|
||||
{
|
||||
/**
|
||||
* Fire an event and call the listeners.
|
||||
*
|
||||
* @param string $event
|
||||
* @param mixed $payload
|
||||
* @param bool $halt
|
||||
* @return array|null
|
||||
*/
|
||||
function event($event, $payload = array(), $halt = false)
|
||||
{
|
||||
return app('events')->fire($event, $payload, $halt);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists('elixir'))
|
||||
{
|
||||
/**
|
||||
* Get the path to a versioned Elixir file.
|
||||
*
|
||||
* @param string $file
|
||||
* @return string
|
||||
*/
|
||||
function elixir($file)
|
||||
{
|
||||
static $manifest = null;
|
||||
|
||||
if (is_null($manifest))
|
||||
{
|
||||
$manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true);
|
||||
}
|
||||
|
||||
if (isset($manifest[$file]))
|
||||
{
|
||||
return '/build/'.$manifest[$file];
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user