commit
d2d098006c
@ -0,0 +1,16 @@ |
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
end_of_line = lf |
||||
insert_final_newline = true |
||||
indent_style = space |
||||
indent_size = 4 |
||||
trim_trailing_whitespace = true |
||||
|
||||
[*.md] |
||||
trim_trailing_whitespace = false |
||||
|
||||
[*.yml] |
||||
indent_style = space |
||||
indent_size = 2 |
@ -0,0 +1,39 @@ |
||||
APP_NAME=Laravel |
||||
APP_ENV=local |
||||
APP_KEY= |
||||
APP_DEBUG=true |
||||
APP_URL=http://localhost |
||||
|
||||
LOG_CHANNEL=stack |
||||
|
||||
DB_CONNECTION=mysql |
||||
DB_HOST=127.0.0.1 |
||||
DB_PORT=3306 |
||||
DB_DATABASE=homestead |
||||
DB_USERNAME=homestead |
||||
DB_PASSWORD=secret |
||||
|
||||
BROADCAST_DRIVER=log |
||||
CACHE_DRIVER=file |
||||
SESSION_DRIVER=file |
||||
SESSION_LIFETIME=120 |
||||
QUEUE_DRIVER=sync |
||||
|
||||
REDIS_HOST=127.0.0.1 |
||||
REDIS_PASSWORD=null |
||||
REDIS_PORT=6379 |
||||
|
||||
MAIL_DRIVER=smtp |
||||
MAIL_HOST=smtp.mailtrap.io |
||||
MAIL_PORT=2525 |
||||
MAIL_USERNAME=null |
||||
MAIL_PASSWORD=null |
||||
MAIL_ENCRYPTION=null |
||||
|
||||
PUSHER_APP_ID= |
||||
PUSHER_APP_KEY= |
||||
PUSHER_APP_SECRET= |
||||
PUSHER_APP_CLUSTER=mt1 |
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" |
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" |
@ -0,0 +1,5 @@ |
||||
* text=auto |
||||
*.css linguist-vendored |
||||
*.scss linguist-vendored |
||||
*.js linguist-vendored |
||||
CHANGELOG.md export-ignore |
@ -0,0 +1,13 @@ |
||||
/node_modules |
||||
/public/hot |
||||
/public/storage |
||||
/storage/*.key |
||||
/vendor |
||||
/.idea |
||||
/.vscode |
||||
/.vagrant |
||||
Homestead.json |
||||
Homestead.yaml |
||||
npm-debug.log |
||||
yarn-error.log |
||||
.env |
@ -0,0 +1,987 @@ |
||||
<?php |
||||
namespace PHPSTORM_META { |
||||
|
||||
/** |
||||
* PhpStorm Meta file, to provide autocomplete information for PhpStorm |
||||
* Generated on 2018-07-08 15:16:12. |
||||
* |
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com> |
||||
* @see https://github.com/barryvdh/laravel-ide-helper |
||||
*/ |
||||
override(new \Illuminate\Contracts\Container\Container, map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\Illuminate\Contracts\Container\Container::make(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\Illuminate\Contracts\Container\Container::makeWith(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\App::make(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\App::makeWith(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\app(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
override(\resolve(0), map([ |
||||
'' => '@', |
||||
'events' => \Illuminate\Events\Dispatcher::class, |
||||
'log' => \Illuminate\Log\LogManager::class, |
||||
'router' => \Illuminate\Routing\Router::class, |
||||
'url' => \Illuminate\Routing\UrlGenerator::class, |
||||
'redirect' => \Illuminate\Routing\Redirector::class, |
||||
'Illuminate\Contracts\Routing\ResponseFactory' => \Illuminate\Routing\ResponseFactory::class, |
||||
'Illuminate\Routing\Contracts\ControllerDispatcher' => \Illuminate\Routing\ControllerDispatcher::class, |
||||
'Illuminate\Contracts\Http\Kernel' => \App\Http\Kernel::class, |
||||
'Illuminate\Contracts\Console\Kernel' => \App\Console\Kernel::class, |
||||
'Illuminate\Contracts\Debug\ExceptionHandler' => \NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler::class, |
||||
'auth' => \Illuminate\Auth\AuthManager::class, |
||||
'auth.driver' => \Illuminate\Auth\SessionGuard::class, |
||||
'Illuminate\Contracts\Auth\Access\Gate' => \Illuminate\Auth\Access\Gate::class, |
||||
'cookie' => \Illuminate\Cookie\CookieJar::class, |
||||
'db.factory' => \Illuminate\Database\Connectors\ConnectionFactory::class, |
||||
'db' => \Illuminate\Database\DatabaseManager::class, |
||||
'db.connection' => \Illuminate\Database\MySqlConnection::class, |
||||
'Illuminate\Contracts\Queue\EntityResolver' => \Illuminate\Database\Eloquent\QueueEntityResolver::class, |
||||
'encrypter' => \Illuminate\Encryption\Encrypter::class, |
||||
'files' => \Illuminate\Filesystem\Filesystem::class, |
||||
'filesystem' => \Illuminate\Filesystem\FilesystemManager::class, |
||||
'filesystem.disk' => \Illuminate\Filesystem\FilesystemAdapter::class, |
||||
'Illuminate\Notifications\ChannelManager' => \Illuminate\Notifications\ChannelManager::class, |
||||
'session' => \Illuminate\Session\SessionManager::class, |
||||
'session.store' => \Illuminate\Session\Store::class, |
||||
'Illuminate\Session\Middleware\StartSession' => \Illuminate\Session\Middleware\StartSession::class, |
||||
'view' => \Illuminate\View\Factory::class, |
||||
'view.finder' => \Illuminate\View\FileViewFinder::class, |
||||
'view.engine.resolver' => \Illuminate\View\Engines\EngineResolver::class, |
||||
'blade.compiler' => \Illuminate\View\Compilers\BladeCompiler::class, |
||||
'Illuminate\Console\Scheduling\Schedule' => \Illuminate\Console\Scheduling\Schedule::class, |
||||
'cache' => \Illuminate\Cache\CacheManager::class, |
||||
'cache.store' => \Illuminate\Cache\Repository::class, |
||||
'memcached.connector' => \Illuminate\Cache\MemcachedConnector::class, |
||||
'Illuminate\Broadcasting\BroadcastManager' => \Illuminate\Broadcasting\BroadcastManager::class, |
||||
'Illuminate\Contracts\Broadcasting\Broadcaster' => \Illuminate\Broadcasting\Broadcasters\LogBroadcaster::class, |
||||
'Illuminate\Bus\Dispatcher' => \Illuminate\Bus\Dispatcher::class, |
||||
'command.cache.clear' => \Illuminate\Cache\Console\ClearCommand::class, |
||||
'command.cache.forget' => \Illuminate\Cache\Console\ForgetCommand::class, |
||||
'command.clear-compiled' => \Illuminate\Foundation\Console\ClearCompiledCommand::class, |
||||
'command.auth.resets.clear' => \Illuminate\Auth\Console\ClearResetsCommand::class, |
||||
'command.config.cache' => \Illuminate\Foundation\Console\ConfigCacheCommand::class, |
||||
'command.config.clear' => \Illuminate\Foundation\Console\ConfigClearCommand::class, |
||||
'command.down' => \Illuminate\Foundation\Console\DownCommand::class, |
||||
'command.environment' => \Illuminate\Foundation\Console\EnvironmentCommand::class, |
||||
'command.key.generate' => \Illuminate\Foundation\Console\KeyGenerateCommand::class, |
||||
'command.migrate' => \Illuminate\Database\Console\Migrations\MigrateCommand::class, |
||||
'command.migrate.fresh' => \Illuminate\Database\Console\Migrations\FreshCommand::class, |
||||
'command.migrate.install' => \Illuminate\Database\Console\Migrations\InstallCommand::class, |
||||
'command.migrate.refresh' => \Illuminate\Database\Console\Migrations\RefreshCommand::class, |
||||
'command.migrate.reset' => \Illuminate\Database\Console\Migrations\ResetCommand::class, |
||||
'command.migrate.rollback' => \Illuminate\Database\Console\Migrations\RollbackCommand::class, |
||||
'command.migrate.status' => \Illuminate\Database\Console\Migrations\StatusCommand::class, |
||||
'command.package.discover' => \Illuminate\Foundation\Console\PackageDiscoverCommand::class, |
||||
'command.preset' => \Illuminate\Foundation\Console\PresetCommand::class, |
||||
'command.queue.failed' => \Illuminate\Queue\Console\ListFailedCommand::class, |
||||
'command.queue.flush' => \Illuminate\Queue\Console\FlushFailedCommand::class, |
||||
'command.queue.forget' => \Illuminate\Queue\Console\ForgetFailedCommand::class, |
||||
'command.queue.listen' => \Illuminate\Queue\Console\ListenCommand::class, |
||||
'command.queue.restart' => \Illuminate\Queue\Console\RestartCommand::class, |
||||
'command.queue.retry' => \Illuminate\Queue\Console\RetryCommand::class, |
||||
'command.queue.work' => \Illuminate\Queue\Console\WorkCommand::class, |
||||
'command.route.cache' => \Illuminate\Foundation\Console\RouteCacheCommand::class, |
||||
'command.route.clear' => \Illuminate\Foundation\Console\RouteClearCommand::class, |
||||
'command.route.list' => \Illuminate\Foundation\Console\RouteListCommand::class, |
||||
'command.seed' => \Illuminate\Database\Console\Seeds\SeedCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleFinishCommand' => \Illuminate\Console\Scheduling\ScheduleFinishCommand::class, |
||||
'Illuminate\Console\Scheduling\ScheduleRunCommand' => \Illuminate\Console\Scheduling\ScheduleRunCommand::class, |
||||
'command.storage.link' => \Illuminate\Foundation\Console\StorageLinkCommand::class, |
||||
'command.up' => \Illuminate\Foundation\Console\UpCommand::class, |
||||
'command.view.cache' => \Illuminate\Foundation\Console\ViewCacheCommand::class, |
||||
'command.view.clear' => \Illuminate\Foundation\Console\ViewClearCommand::class, |
||||
'command.app.name' => \Illuminate\Foundation\Console\AppNameCommand::class, |
||||
'command.auth.make' => \Illuminate\Auth\Console\AuthMakeCommand::class, |
||||
'command.cache.table' => \Illuminate\Cache\Console\CacheTableCommand::class, |
||||
'command.channel.make' => \Illuminate\Foundation\Console\ChannelMakeCommand::class, |
||||
'command.console.make' => \Illuminate\Foundation\Console\ConsoleMakeCommand::class, |
||||
'command.controller.make' => \Illuminate\Routing\Console\ControllerMakeCommand::class, |
||||
'command.event.generate' => \Illuminate\Foundation\Console\EventGenerateCommand::class, |
||||
'command.event.make' => \Illuminate\Foundation\Console\EventMakeCommand::class, |
||||
'command.exception.make' => \Illuminate\Foundation\Console\ExceptionMakeCommand::class, |
||||
'command.factory.make' => \Illuminate\Database\Console\Factories\FactoryMakeCommand::class, |
||||
'command.job.make' => \Illuminate\Foundation\Console\JobMakeCommand::class, |
||||
'command.listener.make' => \Illuminate\Foundation\Console\ListenerMakeCommand::class, |
||||
'command.mail.make' => \Illuminate\Foundation\Console\MailMakeCommand::class, |
||||
'command.middleware.make' => \Illuminate\Routing\Console\MiddlewareMakeCommand::class, |
||||
'command.migrate.make' => \Illuminate\Database\Console\Migrations\MigrateMakeCommand::class, |
||||
'command.model.make' => \Illuminate\Foundation\Console\ModelMakeCommand::class, |
||||
'command.notification.make' => \Illuminate\Foundation\Console\NotificationMakeCommand::class, |
||||
'command.notification.table' => \Illuminate\Notifications\Console\NotificationTableCommand::class, |
||||
'command.observer.make' => \Illuminate\Foundation\Console\ObserverMakeCommand::class, |
||||
'command.policy.make' => \Illuminate\Foundation\Console\PolicyMakeCommand::class, |
||||
'command.provider.make' => \Illuminate\Foundation\Console\ProviderMakeCommand::class, |
||||
'command.queue.failed-table' => \Illuminate\Queue\Console\FailedTableCommand::class, |
||||
'command.queue.table' => \Illuminate\Queue\Console\TableCommand::class, |
||||
'command.request.make' => \Illuminate\Foundation\Console\RequestMakeCommand::class, |
||||
'command.resource.make' => \Illuminate\Foundation\Console\ResourceMakeCommand::class, |
||||
'command.rule.make' => \Illuminate\Foundation\Console\RuleMakeCommand::class, |
||||
'command.seeder.make' => \Illuminate\Database\Console\Seeds\SeederMakeCommand::class, |
||||
'command.session.table' => \Illuminate\Session\Console\SessionTableCommand::class, |
||||
'command.serve' => \Illuminate\Foundation\Console\ServeCommand::class, |
||||
'command.test.make' => \Illuminate\Foundation\Console\TestMakeCommand::class, |
||||
'command.vendor.publish' => \Illuminate\Foundation\Console\VendorPublishCommand::class, |
||||
'migration.repository' => \Illuminate\Database\Migrations\DatabaseMigrationRepository::class, |
||||
'migrator' => \Illuminate\Database\Migrations\Migrator::class, |
||||
'migration.creator' => \Illuminate\Database\Migrations\MigrationCreator::class, |
||||
'composer' => \Illuminate\Support\Composer::class, |
||||
'hash' => \Illuminate\Hashing\HashManager::class, |
||||
'hash.driver' => \Illuminate\Hashing\BcryptHasher::class, |
||||
'swift.transport' => \Illuminate\Mail\TransportManager::class, |
||||
'swift.mailer' => \Swift_Mailer::class, |
||||
'mailer' => \Illuminate\Mail\Mailer::class, |
||||
'Illuminate\Mail\Markdown' => \Illuminate\Mail\Markdown::class, |
||||
'Illuminate\Contracts\Pipeline\Hub' => \Illuminate\Pipeline\Hub::class, |
||||
'queue' => \Illuminate\Queue\QueueManager::class, |
||||
'queue.connection' => \Illuminate\Queue\SyncQueue::class, |
||||
'queue.worker' => \Illuminate\Queue\Worker::class, |
||||
'queue.listener' => \Illuminate\Queue\Listener::class, |
||||
'queue.failer' => \Illuminate\Queue\Failed\DatabaseFailedJobProvider::class, |
||||
'redis' => \Illuminate\Redis\RedisManager::class, |
||||
'auth.password' => \Illuminate\Auth\Passwords\PasswordBrokerManager::class, |
||||
'auth.password.broker' => \Illuminate\Auth\Passwords\PasswordBroker::class, |
||||
'translation.loader' => \Illuminate\Translation\FileLoader::class, |
||||
'translator' => \Illuminate\Translation\Translator::class, |
||||
'validation.presence' => \Illuminate\Validation\DatabasePresenceVerifier::class, |
||||
'command.ide-helper.generate' => \Barryvdh\LaravelIdeHelper\Console\GeneratorCommand::class, |
||||
'command.ide-helper.models' => \Barryvdh\LaravelIdeHelper\Console\ModelsCommand::class, |
||||
'command.ide-helper.meta' => \Barryvdh\LaravelIdeHelper\Console\MetaCommand::class, |
||||
'command.ide-helper.eloquent' => \Barryvdh\LaravelIdeHelper\Console\EloquentCommand::class, |
||||
'command.tinker' => \Laravel\Tinker\Console\TinkerCommand::class, |
||||
'NunoMaduro\Collision\Contracts\Adapters\Phpunit\Listener' => \NunoMaduro\Collision\Adapters\Phpunit\Listener::class, |
||||
'NunoMaduro\Collision\Contracts\Provider' => \NunoMaduro\Collision\Provider::class, |
||||
])); |
||||
|
||||
override(\Illuminate\Support\Arr::add(0), type(0)); |
||||
override(\Illuminate\Support\Arr::except(0), type(0)); |
||||
override(\Illuminate\Support\Arr::first(0), elementType(0)); |
||||
override(\Illuminate\Support\Arr::last(0), elementType(0)); |
||||
override(\Illuminate\Support\Arr::get(0), elementType(0)); |
||||
override(\Illuminate\Support\Arr::only(0), type(0)); |
||||
override(\Illuminate\Support\Arr::prepend(0), type(0)); |
||||
override(\Illuminate\Support\Arr::pull(0), elementType(0)); |
||||
override(\Illuminate\Support\Arr::set(0), type(0)); |
||||
override(\Illuminate\Support\Arr::shuffle(0), type(0)); |
||||
override(\Illuminate\Support\Arr::sort(0), type(0)); |
||||
override(\Illuminate\Support\Arr::sortRecursive(0), type(0)); |
||||
override(\Illuminate\Support\Arr::where(0), type(0)); |
||||
override(\array_add(0), type(0)); |
||||
override(\array_except(0), type(0)); |
||||
override(\array_first(0), elementType(0)); |
||||
override(\array_last(0), elementType(0)); |
||||
override(\array_get(0), elementType(0)); |
||||
override(\array_only(0), type(0)); |
||||
override(\array_prepend(0), type(0)); |
||||
override(\array_pull(0), elementType(0)); |
||||
override(\array_set(0), type(0)); |
||||
override(\array_sort(0), type(0)); |
||||
override(\array_sort_recursive(0), type(0)); |
||||
override(\array_where(0), type(0)); |
||||
override(\head(0), elementType(0)); |
||||
override(\last(0), elementType(0)); |
||||
override(\with(0), type(0)); |
||||
override(\tap(0), type(0)); |
||||
|
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@ |
||||
<?php |
||||
|
||||
namespace App\Console; |
||||
|
||||
use Illuminate\Console\Scheduling\Schedule; |
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; |
||||
|
||||
class Kernel extends ConsoleKernel |
||||
{ |
||||
/** |
||||
* The Artisan commands provided by your application. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $commands = [ |
||||
// |
||||
]; |
||||
|
||||
/** |
||||
* Define the application's command schedule. |
||||
* |
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule |
||||
* @return void |
||||
*/ |
||||
protected function schedule(Schedule $schedule) |
||||
{ |
||||
// $schedule->command('inspire') |
||||
// ->hourly(); |
||||
} |
||||
|
||||
/** |
||||
* Register the commands for the application. |
||||
* |
||||
* @return void |
||||
*/ |
||||
protected function commands() |
||||
{ |
||||
$this->load(__DIR__.'/Commands'); |
||||
|
||||
require base_path('routes/console.php'); |
||||
} |
||||
} |
@ -0,0 +1,51 @@ |
||||
<?php |
||||
|
||||
namespace App\Exceptions; |
||||
|
||||
use Exception; |
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
||||
|
||||
class Handler extends ExceptionHandler |
||||
{ |
||||
/** |
||||
* A list of the exception types that are not reported. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $dontReport = [ |
||||
// |
||||
]; |
||||
|
||||
/** |
||||
* A list of the inputs that are never flashed for validation exceptions. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $dontFlash = [ |
||||
'password', |
||||
'password_confirmation', |
||||
]; |
||||
|
||||
/** |
||||
* Report or log an exception. |
||||
* |
||||
* @param \Exception $exception |
||||
* @return void |
||||
*/ |
||||
public function report(Exception $exception) |
||||
{ |
||||
parent::report($exception); |
||||
} |
||||
|
||||
/** |
||||
* Render an exception into an HTTP response. |
||||
* |
||||
* @param \Illuminate\Http\Request $request |
||||
* @param \Exception $exception |
||||
* @return \Illuminate\Http\Response |
||||
*/ |
||||
public function render($request, Exception $exception) |
||||
{ |
||||
return parent::render($request, $exception); |
||||
} |
||||
} |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Auth; |
||||
|
||||
use App\Http\Controllers\Controller; |
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails; |
||||
|
||||
class ForgotPasswordController extends Controller |
||||
{ |
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Password Reset Controller |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This controller is responsible for handling password reset emails and |
||||
| includes a trait which assists in sending these notifications from |
||||
| your application to your users. Feel free to explore this trait. |
||||
| |
||||
*/ |
||||
|
||||
use SendsPasswordResetEmails; |
||||
|
||||
/** |
||||
* Create a new controller instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->middleware('guest'); |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Auth; |
||||
|
||||
use App\Http\Controllers\Controller; |
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers; |
||||
|
||||
class LoginController extends Controller |
||||
{ |
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Login Controller |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This controller handles authenticating users for the application and |
||||
| redirecting them to your home screen. The controller uses a trait |
||||
| to conveniently provide its functionality to your applications. |
||||
| |
||||
*/ |
||||
|
||||
use AuthenticatesUsers; |
||||
|
||||
/** |
||||
* Where to redirect users after login. |
||||
* |
||||
* @var string |
||||
*/ |
||||
protected $redirectTo = '/home'; |
||||
|
||||
/** |
||||
* Create a new controller instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->middleware('guest')->except('logout'); |
||||
} |
||||
} |
@ -0,0 +1,72 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Auth; |
||||
|
||||
use App\Models\User; |
||||
use App\Http\Controllers\Controller; |
||||
use Illuminate\Support\Facades\Hash; |
||||
use Illuminate\Support\Facades\Validator; |
||||
use Illuminate\Foundation\Auth\RegistersUsers; |
||||
|
||||
class RegisterController extends Controller |
||||
{ |
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Register Controller |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This controller handles the registration of new users as well as their |
||||
| validation and creation. By default this controller uses a trait to |
||||
| provide this functionality without requiring any additional code. |
||||
| |
||||
*/ |
||||
|
||||
use RegistersUsers; |
||||
|
||||
/** |
||||
* Where to redirect users after registration. |
||||
* |
||||
* @var string |
||||
*/ |
||||
protected $redirectTo = '/home'; |
||||
|
||||
/** |
||||
* Create a new controller instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->middleware('guest'); |
||||
} |
||||
|
||||
/** |
||||
* Get a validator for an incoming registration request. |
||||
* |
||||
* @param array $data |
||||
* @return \Illuminate\Contracts\Validation\Validator |
||||
*/ |
||||
protected function validator(array $data) |
||||
{ |
||||
return Validator::make($data, [ |
||||
'name' => 'required|string|max:255', |
||||
'email' => 'required|string|email|max:255|unique:users', |
||||
'password' => 'required|string|min:6|confirmed', |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* Create a new user instance after a valid registration. |
||||
* |
||||
* @param array $data |
||||
* @return \App\Models\User |
||||
*/ |
||||
protected function create(array $data) |
||||
{ |
||||
return User::create([ |
||||
'name' => $data['name'], |
||||
'email' => $data['email'], |
||||
'password' => Hash::make($data['password']), |
||||
]); |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Auth; |
||||
|
||||
use App\Http\Controllers\Controller; |
||||
use Illuminate\Foundation\Auth\ResetsPasswords; |
||||
|
||||
class ResetPasswordController extends Controller |
||||
{ |
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Password Reset Controller |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This controller is responsible for handling password reset requests |
||||
| and uses a simple trait to include this behavior. You're free to |
||||
| explore this trait and override any methods you wish to tweak. |
||||
| |
||||
*/ |
||||
|
||||
use ResetsPasswords; |
||||
|
||||
/** |
||||
* Where to redirect users after resetting their password. |
||||
* |
||||
* @var string |
||||
*/ |
||||
protected $redirectTo = '/home'; |
||||
|
||||
/** |
||||
* Create a new controller instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
$this->middleware('guest'); |
||||
} |
||||
} |
@ -0,0 +1,13 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs; |
||||
use Illuminate\Routing\Controller as BaseController; |
||||
use Illuminate\Foundation\Validation\ValidatesRequests; |
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
||||
|
||||
class Controller extends BaseController |
||||
{ |
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
||||
} |
@ -0,0 +1,63 @@ |
||||
<?php |
||||
|
||||
namespace App\Http; |
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel; |
||||
|
||||
class Kernel extends HttpKernel |
||||
{ |
||||
/** |
||||
* The application's global HTTP middleware stack. |
||||
* |
||||
* These middleware are run during every request to your application. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $middleware = [ |
||||
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, |
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, |
||||
\App\Http\Middleware\TrimStrings::class, |
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, |
||||
\App\Http\Middleware\TrustProxies::class, |
||||
]; |
||||
|
||||
/** |
||||
* The application's route middleware groups. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $middlewareGroups = [ |
||||
'web' => [ |
||||
\App\Http\Middleware\EncryptCookies::class, |
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, |
||||
\Illuminate\Session\Middleware\StartSession::class, |
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class, |
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class, |
||||
\App\Http\Middleware\VerifyCsrfToken::class, |
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class, |
||||
], |
||||
|
||||
'api' => [ |
||||
'throttle:60,1', |
||||
'bindings', |
||||
], |
||||
]; |
||||
|
||||
/** |
||||
* The application's route middleware. |
||||
* |
||||
* These middleware may be assigned to groups or used individually. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $routeMiddleware = [ |
||||
'auth' => \Illuminate\Auth\Middleware\Authenticate::class, |
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, |
||||
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, |
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, |
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class, |
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, |
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, |
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
||||
]; |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Middleware; |
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware; |
||||
|
||||
class EncryptCookies extends Middleware |
||||
{ |
||||
/** |
||||
* The names of the cookies that should not be encrypted. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $except = [ |
||||
// |
||||
]; |
||||
} |
@ -0,0 +1,26 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Middleware; |
||||
|
||||
use Closure; |
||||
use Illuminate\Support\Facades\Auth; |
||||
|
||||
class RedirectIfAuthenticated |
||||
{ |
||||
/** |
||||
* Handle an incoming request. |
||||
* |
||||
* @param \Illuminate\Http\Request $request |
||||
* @param \Closure $next |
||||
* @param string|null $guard |
||||
* @return mixed |
||||
*/ |
||||
public function handle($request, Closure $next, $guard = null) |
||||
{ |
||||
if (Auth::guard($guard)->check()) { |
||||
return redirect('/home'); |
||||
} |
||||
|
||||
return $next($request); |
||||
} |
||||
} |
@ -0,0 +1,18 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Middleware; |
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware; |
||||
|
||||
class TrimStrings extends Middleware |
||||
{ |
||||
/** |
||||
* The names of the attributes that should not be trimmed. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $except = [ |
||||
'password', |
||||
'password_confirmation', |
||||
]; |
||||
} |
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Middleware; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use Fideloper\Proxy\TrustProxies as Middleware; |
||||
|
||||
class TrustProxies extends Middleware |
||||
{ |
||||
/** |
||||
* The trusted proxies for this application. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $proxies; |
||||
|
||||
/** |
||||
* The headers that should be used to detect proxies. |
||||
* |
||||
* @var int |
||||
*/ |
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL; |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Middleware; |
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; |
||||
|
||||
class VerifyCsrfToken extends Middleware |
||||
{ |
||||
/** |
||||
* The URIs that should be excluded from CSRF verification. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $except = [ |
||||
// |
||||
]; |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
|
||||
namespace App; |
||||
|
||||
use Monolog\Logger as MonologLogger; |
||||
|
||||
/** |
||||
* Custom logger to solve the log permissions nightmare |
||||
*/ |
||||
class Logger { |
||||
public function __invoke(array $config) |
||||
{ |
||||
$monolog = new MonologLogger('my-logger'); |
||||
$filename = storage_path('logs/' . php_sapi_name() . '-' . posix_getpwuid(posix_geteuid())['name'] . '.log'); |
||||
$monolog->pushHandler($handler = new \Monolog\Handler\RotatingFileHandler($filename, 30)); |
||||
$handler->setFilenameFormat('laravel-{date}-{filename}', 'Y-m-d'); |
||||
$formatter = new \Monolog\Formatter\LineFormatter(null, null, true, true); |
||||
$formatter->includeStacktraces(); |
||||
$handler->setFormatter($formatter); |
||||
return $monolog; |
||||
} |
||||
} |
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Notifications\Notifiable; |
||||
use Illuminate\Foundation\Auth\User as Authenticatable; |
||||
|
||||
class User extends Authenticatable |
||||
{ |
||||
use Notifiable; |
||||
|
||||
/** |
||||
* The attributes that are mass assignable. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $fillable = [ |
||||
'name', 'email', 'password', |
||||
]; |
||||
|
||||
/** |
||||
* The attributes that should be hidden for arrays. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $hidden = [ |
||||
'password', 'remember_token', |
||||
]; |
||||
} |
@ -0,0 +1,28 @@ |
||||
<?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() |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
|
||||
namespace App\Providers; |
||||
|
||||
use Illuminate\Support\Facades\Gate; |
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; |
||||
|
||||
class AuthServiceProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* The policy mappings for the application. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $policies = [ |
||||
'App\Model' => 'App\Policies\ModelPolicy', |
||||
]; |
||||
|
||||
/** |
||||
* Register any authentication / authorization services. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
$this->registerPolicies(); |
||||
|
||||
// |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
|
||||
namespace App\Providers; |
||||
|
||||
use Illuminate\Support\ServiceProvider; |
||||
use Illuminate\Support\Facades\Broadcast; |
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* Bootstrap any application services. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
Broadcast::routes(); |
||||
|
||||
require base_path('routes/channels.php'); |
||||
} |
||||
} |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
namespace App\Providers; |
||||
|
||||
use Illuminate\Support\Facades\Event; |
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; |
||||
|
||||
class EventServiceProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* The event listener mappings for the application. |
||||
* |
||||
* @var array |
||||
*/ |
||||
protected $listen = [ |
||||
'App\Events\Event' => [ |
||||
'App\Listeners\EventListener', |
||||
], |
||||
]; |
||||
|
||||
/** |
||||
* Register any events for your application. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
parent::boot(); |
||||
|
||||
// |
||||
} |
||||
} |
@ -0,0 +1,73 @@ |
||||
<?php |
||||
|
||||
namespace App\Providers; |
||||
|
||||
use Illuminate\Support\Facades\Route; |
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; |
||||
|
||||
class RouteServiceProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* This namespace is applied to your controller routes. |
||||
* |
||||
* In addition, it is set as the URL generator's root namespace. |
||||
* |
||||
* @var string |
||||
*/ |
||||
protected $namespace = 'App\Http\Controllers'; |
||||
|
||||
/** |
||||
* Define your route model bindings, pattern filters, etc. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
// |
||||
|
||||
parent::boot(); |
||||
} |
||||
|
||||
/** |
||||
* Define the routes for the application. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function map() |
||||
{ |
||||
$this->mapApiRoutes(); |
||||
|
||||
$this->mapWebRoutes(); |
||||
|
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Define the "web" routes for the application. |
||||
* |
||||
* These routes all receive session state, CSRF protection, etc. |
||||
* |
||||
* @return void |
||||
*/ |
||||
protected function mapWebRoutes() |
||||
{ |
||||
Route::middleware('web') |
||||
->namespace($this->namespace) |
||||
->group(base_path('routes/web.php')); |
||||
} |
||||
|
||||
/** |
||||
* Define the "api" routes for the application. |
||||
* |
||||
* These routes are typically stateless. |
||||
* |
||||
* @return void |
||||
*/ |
||||
protected function mapApiRoutes() |
||||
{ |
||||
Route::prefix('api') |
||||
->middleware('api') |
||||
->namespace($this->namespace) |
||||
->group(base_path('routes/api.php')); |
||||
} |
||||
} |
@ -0,0 +1,3 @@ |
||||
<?php |
||||
|
||||
// global helpers |
@ -0,0 +1,53 @@ |
||||
#!/usr/bin/env php |
||||
<?php |
||||
|
||||
define('LARAVEL_START', microtime(true)); |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Register The Auto Loader |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Composer provides a convenient, automatically generated class loader |
||||
| for our application. We just need to utilize it! We'll require it |
||||
| into the script here so that we do not have to worry about the |
||||
| loading of any our classes "manually". Feels great to relax. |
||||
| |
||||
*/ |
||||
|
||||
require __DIR__.'/vendor/autoload.php'; |
||||
|
||||
$app = require_once __DIR__.'/bootstrap/app.php'; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Run The Artisan Application |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When we run the console application, the current CLI command will be |
||||
| executed in this console and the response sent back to a terminal |
||||
| or another output device for the developers. Here goes nothing! |
||||
| |
||||
*/ |
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); |
||||
|
||||
$status = $kernel->handle( |
||||
$input = new Symfony\Component\Console\Input\ArgvInput, |
||||
new Symfony\Component\Console\Output\ConsoleOutput |
||||
); |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Shutdown The Application |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Once Artisan has finished running, we will fire off the shutdown events |
||||
| so that any final work may be done by the application before we shut |
||||
| down the process. This is the last thing to happen to the request. |
||||
| |
||||
*/ |
||||
|
||||
$kernel->terminate($input, $status); |
||||
|
||||
exit($status); |
@ -0,0 +1,63 @@ |
||||
<?php |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Create The Application |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The first thing we will do is create a new Laravel application instance |
||||
| which serves as the "glue" for all the components of Laravel, and is |
||||
| the IoC container for the system binding all of the various parts. |
||||
| |
||||
*/ |
||||
|
||||
$app = new Illuminate\Foundation\Application( |
||||
realpath(__DIR__.'/../') |
||||
); |
||||
|
||||
// added |
||||
// define PHP_INT_MIN for php < 7 |
||||
defined('PHP_INT_MIN') or define('PHP_INT_MIN', ~PHP_INT_MAX); |
||||
|
||||
// laravel start time |
||||
defined('APP_START_TIME') or define('APP_START_TIME', microtime(true)); |
||||
|
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Bind Important Interfaces |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Next, we need to bind some important interfaces into the container so |
||||
| we will be able to resolve them when needed. The kernels serve the |
||||
| incoming requests to this application from both the web and CLI. |
||||
| |
||||
*/ |
||||
|
||||
$app->singleton( |
||||
Illuminate\Contracts\Http\Kernel::class, |
||||
App\Http\Kernel::class |
||||
); |
||||
|
||||
$app->singleton( |
||||
Illuminate\Contracts\Console\Kernel::class, |
||||
App\Console\Kernel::class |
||||
); |
||||
|
||||
$app->singleton( |
||||
Illuminate\Contracts\Debug\ExceptionHandler::class, |
||||
App\Exceptions\Handler::class |
||||
); |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Return The Application |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This script returns the application instance. The instance is given to |
||||
| the calling script so we can separate the building of the instances |
||||
| from the actual running of the application and sending responses. |
||||
| |
||||
*/ |
||||
|
||||
return $app; |
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
@ -0,0 +1,82 @@ |
||||
{ |
||||
"name": "laravel/laravel", |
||||
"description": "The Laravel Framework.", |
||||
"keywords": [ |
||||
"framework", |
||||
"laravel" |
||||
], |
||||
"license": "MIT", |
||||
"type": "project", |
||||
"require": { |
||||
"php": "^7.1.3", |
||||
"barryvdh/laravel-ide-helper": "^2.4", |
||||
"doctrine/dbal": "^2.7", |
||||
"fideloper/proxy": "^4.0", |
||||
"laravel/framework": "5.6.*", |
||||
"laravel/tinker": "^1.0", |
||||
"phpoffice/phpspreadsheet": "^1.3" |
||||
}, |
||||
"require-dev": { |
||||
"filp/whoops": "^2.0", |
||||
"fzaninotto/faker": "^1.4", |
||||
"mockery/mockery": "^1.0", |
||||
"nunomaduro/collision": "^2.0", |
||||
"phpunit/phpunit": "^7.0" |
||||
}, |
||||
"autoload": { |
||||
"classmap": [ |
||||
"database/seeds", |
||||
"database/factories" |
||||
], |
||||
"psr-4": { |
||||
"App\\": "app/", |
||||
"MightyPork\\": "porklib/" |
||||
}, |
||||
"files": [ |
||||
"porklib/helpers.php", |
||||
"app/helpers.php" |
||||
] |
||||
}, |
||||
"autoload-dev": { |
||||
"psr-4": { |
||||
"Tests\\": "tests/" |
||||
} |
||||
}, |
||||
"extra": { |
||||
"laravel": { |
||||
"dont-discover": [ |
||||
] |
||||
} |
||||
}, |
||||
"scripts": { |
||||
"post-root-package-install": [ |
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" |
||||
], |
||||
"post-create-project-cmd": [ |
||||
"@php artisan key:generate" |
||||
], |
||||
"post-autoload-dump": [ |
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", |
||||
"@php artisan package:discover" |
||||
], |
||||
"post-install-cmd": [ |
||||
"./patch_vendor.sh", |
||||
"Illuminate\\Foundation\\ComposerScripts::postInstall", |
||||
"php artisan ide-helper:generate", |
||||
"php artisan ide-helper:meta" |
||||
], |
||||
"post-update-cmd": [ |
||||
"./patch_vendor.sh", |
||||
"Illuminate\\Foundation\\ComposerScripts::postUpdate", |
||||
"php artisan ide-helper:generate", |
||||
"php artisan ide-helper:meta" |
||||
] |
||||
}, |
||||
"config": { |
||||
"preferred-install": "dist", |
||||
"sort-packages": true, |
||||
"optimize-autoloader": true |
||||
}, |
||||
"minimum-stability": "dev", |
||||
"prefer-stable": true |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,218 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Name |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This value is the name of your application. This value is used when the |
||||
| framework needs to place the application's name in a notification or |
||||
| any other location as required by the application or its packages. |
||||
| |
||||
*/ |
||||
|
||||
'name' => env('APP_NAME', 'Laravel'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Environment |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This value determines the "environment" your application is currently |
||||
| running in. This may determine how you prefer to configure various |
||||
| services your application utilizes. Set this in your ".env" file. |
||||
| |
||||
*/ |
||||
|
||||
'env' => env('APP_ENV', 'production'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Debug Mode |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When your application is in debug mode, detailed error messages with |
||||
| stack traces will be shown on every error that occurs within your |
||||
| application. If disabled, a simple generic error page is shown. |
||||
| |
||||
*/ |
||||
|
||||
'debug' => env('APP_DEBUG', false), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application URL |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This URL is used by the console to properly generate URLs when using |
||||
| the Artisan command line tool. You should set this to the root of |
||||
| your application so that it is used when running Artisan tasks. |
||||
| |
||||
*/ |
||||
|
||||
'url' => env('APP_URL', 'http://localhost'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Timezone |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the default timezone for your application, which |
||||
| will be used by the PHP date and date-time functions. We have gone |
||||
| ahead and set this to a sensible default for you out of the box. |
||||
| |
||||
*/ |
||||
|
||||
'timezone' => 'UTC', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Locale Configuration |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The application locale determines the default locale that will be used |
||||
| by the translation service provider. You are free to set this value |
||||
| to any of the locales which will be supported by the application. |
||||
| |
||||
*/ |
||||
|
||||
'locale' => 'en', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Application Fallback Locale |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The fallback locale determines the locale to use when the current one |
||||
| is not available. You may change the value to correspond to any of |
||||
| the language folders that are provided through your application. |
||||
| |
||||
*/ |
||||
|
||||
'fallback_locale' => 'en', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Encryption Key |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This key is used by the Illuminate encrypter service and should be set |
||||
| to a random, 32 character string, otherwise these encrypted strings |
||||
| will not be safe. Please do this before deploying an application! |
||||
| |
||||
*/ |
||||
|
||||
'key' => env('APP_KEY'), |
||||
|
||||
'cipher' => 'AES-256-CBC', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Autoloaded Service Providers |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The service providers listed here will be automatically loaded on the |
||||
| request to your application. Feel free to add your own services to |
||||
| this array to grant expanded functionality to your applications. |
||||
| |
||||
*/ |
||||
|
||||
'providers' => [ |
||||
|
||||
/* |
||||
* Laravel Framework Service Providers... |
||||
*/ |
||||
Illuminate\Auth\AuthServiceProvider::class, |
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class, |
||||
Illuminate\Bus\BusServiceProvider::class, |
||||
Illuminate\Cache\CacheServiceProvider::class, |
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, |
||||
Illuminate\Cookie\CookieServiceProvider::class, |
||||
Illuminate\Database\DatabaseServiceProvider::class, |
||||
Illuminate\Encryption\EncryptionServiceProvider::class, |
||||
Illuminate\Filesystem\FilesystemServiceProvider::class, |
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class, |
||||
Illuminate\Hashing\HashServiceProvider::class, |
||||
Illuminate\Mail\MailServiceProvider::class, |
||||
Illuminate\Notifications\NotificationServiceProvider::class, |
||||
Illuminate\Pagination\PaginationServiceProvider::class, |
||||
Illuminate\Pipeline\PipelineServiceProvider::class, |
||||
Illuminate\Queue\QueueServiceProvider::class, |
||||
Illuminate\Redis\RedisServiceProvider::class, |
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, |
||||
Illuminate\Session\SessionServiceProvider::class, |
||||
Illuminate\Translation\TranslationServiceProvider::class, |
||||
Illuminate\Validation\ValidationServiceProvider::class, |
||||
Illuminate\View\ViewServiceProvider::class, |
||||
|
||||
/* |
||||
* Package Service Providers... |
||||
*/ |
||||
|
||||
/* |
||||
* Application Service Providers... |
||||
*/ |
||||
App\Providers\AppServiceProvider::class, |
||||
App\Providers\AuthServiceProvider::class, |
||||
// App\Providers\BroadcastServiceProvider::class, |
||||
App\Providers\EventServiceProvider::class, |
||||
App\Providers\RouteServiceProvider::class, |
||||
|
||||
MightyPork\Providers\BladeExtensionsProvider::class, |
||||
MightyPork\Providers\MacroServiceProvider::class, |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Class Aliases |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This array of class aliases will be registered when this application |
||||
| is started. However, feel free to register as many as you wish as |
||||
| the aliases are "lazy" loaded so they don't hinder performance. |
||||
| |
||||
*/ |
||||
|
||||
'aliases' => [ |
||||
|
||||
'App' => Illuminate\Support\Facades\App::class, |
||||
'Artisan' => Illuminate\Support\Facades\Artisan::class, |
||||
'Auth' => Illuminate\Support\Facades\Auth::class, |
||||
'Blade' => Illuminate\Support\Facades\Blade::class, |
||||
'Broadcast' => Illuminate\Support\Facades\Broadcast::class, |
||||
'Bus' => Illuminate\Support\Facades\Bus::class, |
||||
'Cache' => Illuminate\Support\Facades\Cache::class, |
||||
'Config' => Illuminate\Support\Facades\Config::class, |
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class, |
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class, |
||||
'DB' => Illuminate\Support\Facades\DB::class, |
||||
'Eloquent' => Illuminate\Database\Eloquent\Model::class, |
||||
'Event' => Illuminate\Support\Facades\Event::class, |
||||
'File' => Illuminate\Support\Facades\File::class, |
||||
'Gate' => Illuminate\Support\Facades\Gate::class, |
||||
'Hash' => Illuminate\Support\Facades\Hash::class, |
||||
'Lang' => Illuminate\Support\Facades\Lang::class, |
||||
'Log' => Illuminate\Support\Facades\Log::class, |
||||
'Mail' => Illuminate\Support\Facades\Mail::class, |
||||
'Notification' => Illuminate\Support\Facades\Notification::class, |
||||
'Password' => Illuminate\Support\Facades\Password::class, |
||||
'Queue' => Illuminate\Support\Facades\Queue::class, |
||||
'Redirect' => Illuminate\Support\Facades\Redirect::class, |
||||
'Redis' => Illuminate\Support\Facades\Redis::class, |
||||
'Request' => Illuminate\Support\Facades\Request::class, |
||||
'Response' => Illuminate\Support\Facades\Response::class, |
||||
'Route' => Illuminate\Support\Facades\Route::class, |
||||
'Schema' => Illuminate\Support\Facades\Schema::class, |
||||
'Session' => Illuminate\Support\Facades\Session::class, |
||||
'Storage' => Illuminate\Support\Facades\Storage::class, |
||||
'URL' => Illuminate\Support\Facades\URL::class, |
||||
'Validator' => Illuminate\Support\Facades\Validator::class, |
||||
'View' => Illuminate\Support\Facades\View::class, |
||||
|
||||
], |
||||
|
||||
// -------------- added keys -------------- |
||||
'pretty_json' => env('PRETTY_JSON', false), |
||||
]; |
@ -0,0 +1,102 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Authentication Defaults |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option controls the default authentication "guard" and password |
||||
| reset options for your application. You may change these defaults |
||||
| as required, but they're a perfect start for most applications. |
||||
| |
||||
*/ |
||||
|
||||
'defaults' => [ |
||||
'guard' => 'web', |
||||
'passwords' => 'users', |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Authentication Guards |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Next, you may define every authentication guard for your application. |
||||
| Of course, a great default configuration has been defined for you |
||||
| here which uses session storage and the Eloquent user provider. |
||||
| |
||||
| All authentication drivers have a user provider. This defines how the |
||||
| users are actually retrieved out of your database or other storage |
||||
| mechanisms used by this application to persist your user's data. |
||||
| |
||||
| Supported: "session", "token" |
||||
| |
||||
*/ |
||||
|
||||
'guards' => [ |
||||
'web' => [ |
||||
'driver' => 'session', |
||||
'provider' => 'users', |
||||
], |
||||
|
||||
'api' => [ |
||||
'driver' => 'token', |
||||
'provider' => 'users', |
||||
], |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| User Providers |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| All authentication drivers have a user provider. This defines how the |
||||
| users are actually retrieved out of your database or other storage |
||||
| mechanisms used by this application to persist your user's data. |
||||
| |
||||
| If you have multiple user tables or models you may configure multiple |
||||
| sources which represent each model / table. These sources may then |
||||
| be assigned to any extra authentication guards you have defined. |
||||
| |
||||
| Supported: "database", "eloquent" |
||||
| |
||||
*/ |
||||
|
||||
'providers' => [ |
||||
'users' => [ |
||||
'driver' => 'eloquent', |
||||
'model' => \App\Models\User::class, |
||||
], |
||||
|
||||
// 'users' => [ |
||||
// 'driver' => 'database', |
||||
// 'table' => 'users', |
||||
// ], |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Resetting Passwords |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| You may specify multiple password reset configurations if you have more |
||||
| than one user table or model in the application and you want to have |
||||
| separate password reset settings based on the specific user types. |
||||
| |
||||
| The expire time is the number of minutes that the reset token should be |
||||
| considered valid. This security feature keeps tokens short-lived so |
||||
| they have less time to be guessed. You may change this as needed. |
||||
| |
||||
*/ |
||||
|
||||
'passwords' => [ |
||||
'users' => [ |
||||
'provider' => 'users', |
||||
'table' => 'password_resets', |
||||
'expire' => 60, |
||||
], |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,59 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Broadcaster |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option controls the default broadcaster that will be used by the |
||||
| framework when an event needs to be broadcast. You may set this to |
||||
| any of the connections defined in the "connections" array below. |
||||
| |
||||
| Supported: "pusher", "redis", "log", "null" |
||||
| |
||||
*/ |
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Broadcast Connections |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may define all of the broadcast connections that will be used |
||||
| to broadcast events to other systems or over websockets. Samples of |
||||
| each available type of connection are provided inside this array. |
||||
| |
||||
*/ |
||||
|
||||
'connections' => [ |
||||
|
||||
'pusher' => [ |
||||
'driver' => 'pusher', |
||||
'key' => env('PUSHER_APP_KEY'), |
||||
'secret' => env('PUSHER_APP_SECRET'), |
||||
'app_id' => env('PUSHER_APP_ID'), |
||||
'options' => [ |
||||
'cluster' => env('PUSHER_APP_CLUSTER'), |
||||
'encrypted' => true, |
||||
], |
||||
], |
||||
|
||||
'redis' => [ |
||||
'driver' => 'redis', |
||||
'connection' => 'default', |
||||
], |
||||
|
||||
'log' => [ |
||||
'driver' => 'log', |
||||
], |
||||
|
||||
'null' => [ |
||||
'driver' => 'null', |
||||
], |
||||
|
||||
], |
||||
|
||||
]; |
@ -0,0 +1,94 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Cache Store |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option controls the default cache connection that gets used while |
||||
| using this caching library. This connection is used when another is |
||||
| not explicitly specified when executing a given caching function. |
||||
| |
||||
| Supported: "apc", "array", "database", "file", "memcached", "redis" |
||||
| |
||||
*/ |
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Cache Stores |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may define all of the cache "stores" for your application as |
||||
| well as their drivers. You may even define multiple stores for the |
||||
| same cache driver to group types of items stored in your caches. |
||||
| |
||||
*/ |
||||
|
||||
'stores' => [ |
||||
|
||||
'apc' => [ |
||||
'driver' => 'apc', |
||||
], |
||||
|
||||
'array' => [ |
||||
'driver' => 'array', |
||||
], |
||||
|
||||
'database' => [ |
||||
'driver' => 'database', |
||||
'table' => 'cache', |
||||
'connection' => null, |
||||
], |
||||
|
||||
'file' => [ |
||||
'driver' => 'file', |
||||
'path' => storage_path('framework/cache/data'), |
||||
], |
||||
|
||||
'memcached' => [ |
||||
'driver' => 'memcached', |
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), |
||||
'sasl' => [ |
||||
env('MEMCACHED_USERNAME'), |
||||
env('MEMCACHED_PASSWORD'), |
||||
], |
||||
'options' => [ |
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000, |
||||
], |
||||
'servers' => [ |
||||
[ |
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'), |
||||
'port' => env('MEMCACHED_PORT', 11211), |
||||
'weight' => 100, |
||||
], |
||||
], |
||||
], |
||||
|
||||
'redis' => [ |
||||
'driver' => 'redis', |
||||
'connection' => 'default', |
||||
], |
||||
|
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Cache Key Prefix |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When utilizing a RAM based store such as APC or Memcached, there might |
||||
| be other applications utilizing the same cache. So, we'll specify a |
||||
| value to get prefixed to all our keys so we can avoid collisions. |
||||
| |
||||
*/ |
||||
|
||||
'prefix' => env( |
||||
'CACHE_PREFIX', |
||||
str_slug(env('APP_NAME', 'laravel'), '_').'_cache' |
||||
), |
||||
|
||||
]; |
@ -0,0 +1,120 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Database Connection Name |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify which of the database connections below you wish |
||||
| to use as your default connection for all database work. Of course |
||||
| you may use many connections at once using the Database library. |
||||
| |
||||
*/ |
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Database Connections |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here are each of the database connections setup for your application. |
||||
| Of course, examples of configuring each database platform that is |
||||
| supported by Laravel is shown below to make development simple. |
||||
| |
||||
| |
||||
| All database work in Laravel is done through the PHP PDO facilities |
||||
| so make sure you have the driver for your particular database of |
||||
| choice installed on your machine before you begin development. |
||||
| |
||||
*/ |
||||
|
||||
'connections' => [ |
||||
|
||||
'sqlite' => [ |
||||
'driver' => 'sqlite', |
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')), |
||||
'prefix' => '', |
||||
], |
||||
|
||||
'mysql' => [ |
||||
'driver' => 'mysql', |
||||
'host' => env('DB_HOST', '127.0.0.1'), |
||||
'port' => env('DB_PORT', '3306'), |
||||
'database' => env('DB_DATABASE', 'forge'), |
||||
'username' => env('DB_USERNAME', 'forge'), |
||||
'password' => env('DB_PASSWORD', ''), |
||||
'unix_socket' => env('DB_SOCKET', ''), |
||||
'charset' => 'utf8mb4', |
||||
'collation' => 'utf8mb4_unicode_ci', |
||||
'prefix' => '', |
||||
'strict' => true, |
||||
'engine' => null, |
||||
], |
||||
|
||||
'pgsql' => [ |
||||
'driver' => 'pgsql', |
||||
'host' => env('DB_HOST', '127.0.0.1'), |
||||
'port' => env('DB_PORT', '5432'), |
||||
'database' => env('DB_DATABASE', 'forge'), |
||||
'username' => env('DB_USERNAME', 'forge'), |
||||
'password' => env('DB_PASSWORD', ''), |
||||
'charset' => 'utf8', |
||||
'prefix' => '', |
||||
'schema' => 'public', |
||||
'sslmode' => 'prefer', |
||||
], |
||||
|
||||
'sqlsrv' => [ |
||||
'driver' => 'sqlsrv', |
||||
'host' => env('DB_HOST', 'localhost'), |
||||
'port' => env('DB_PORT', '1433'), |
||||
'database' => env('DB_DATABASE', 'forge'), |
||||
'username' => env('DB_USERNAME', 'forge'), |
||||
'password' => env('DB_PASSWORD', ''), |
||||
'charset' => 'utf8', |
||||
'prefix' => '', |
||||
], |
||||
|
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Migration Repository Table |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This table keeps track of all the migrations that have already run for |
||||
| your application. Using this information, we can determine which of |
||||
| the migrations on disk haven't actually been run in the database. |
||||
| |
||||
*/ |
||||
|
||||
'migrations' => 'migrations', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Redis Databases |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Redis is an open source, fast, and advanced key-value store that also |
||||
| provides a richer set of commands than a typical key-value systems |
||||
| such as APC or Memcached. Laravel makes it easy to dig right in. |
||||
| |
||||
*/ |
||||
|
||||
'redis' => [ |
||||
|
||||
'client' => 'predis', |
||||
|
||||
'default' => [ |
||||
'host' => env('REDIS_HOST', '127.0.0.1'), |
||||
'password' => env('REDIS_PASSWORD', null), |
||||
'port' => env('REDIS_PORT', 6379), |
||||
'database' => 0, |
||||
], |
||||
|
||||
], |
||||
|
||||
]; |
@ -0,0 +1,69 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Filesystem Disk |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the default filesystem disk that should be used |
||||
| by the framework. The "local" disk, as well as a variety of cloud |
||||
| based disks are available to your application. Just store away! |
||||
| |
||||
*/ |
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Cloud Filesystem Disk |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Many applications store files both locally and in the cloud. For this |
||||
| reason, you may specify a default "cloud" driver here. This driver |
||||
| will be bound as the Cloud disk implementation in the container. |
||||
| |
||||
*/ |
||||
|
||||
'cloud' => env('FILESYSTEM_CLOUD', 's3'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Filesystem Disks |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may configure as many filesystem "disks" as you wish, and you |
||||
| may even configure multiple disks of the same driver. Defaults have |
||||
| been setup for each driver as an example of the required options. |
||||
| |
||||
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace" |
||||
| |
||||
*/ |
||||
|
||||
'disks' => [ |
||||
|
||||
'local' => [ |
||||
'driver' => 'local', |
||||
'root' => storage_path('app'), |
||||
], |
||||
|
||||
'public' => [ |
||||
'driver' => 'local', |
||||
'root' => storage_path('app/public'), |
||||
'url' => env('APP_URL').'/storage', |
||||
'visibility' => 'public', |
||||
], |
||||
|
||||
's3' => [ |
||||
'driver' => 's3', |
||||
'key' => env('AWS_ACCESS_KEY_ID'), |
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'), |
||||
'region' => env('AWS_DEFAULT_REGION'), |
||||
'bucket' => env('AWS_BUCKET'), |
||||
'url' => env('AWS_URL'), |
||||
], |
||||
|
||||
], |
||||
|
||||
]; |
@ -0,0 +1,52 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Hash Driver |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option controls the default hash driver that will be used to hash |
||||
| passwords for your application. By default, the bcrypt algorithm is |
||||
| used; however, you remain free to modify this option if you wish. |
||||
| |
||||
| Supported: "bcrypt", "argon" |
||||
| |
||||
*/ |
||||
|
||||
'driver' => 'bcrypt', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Bcrypt Options |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the configuration options that should be used when |
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you |
||||
| to control the amount of time it takes to hash the given password. |
||||
| |
||||
*/ |
||||
|
||||
'bcrypt' => [ |
||||
'rounds' => env('BCRYPT_ROUNDS', 10), |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Argon Options |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the configuration options that should be used when |
||||
| passwords are hashed using the Argon algorithm. These will allow you |
||||
| to control the amount of time it takes to hash the given password. |
||||
| |
||||
*/ |
||||
|
||||
'argon' => [ |
||||
'memory' => 1024, |
||||
'threads' => 2, |
||||
'time' => 2, |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,42 @@ |
||||
<?php |
||||
|
||||
use Monolog\Handler\StreamHandler; |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Log Channel |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option defines the default log channel that gets used when writing |
||||
| messages to the logs. The name specified in this option should match |
||||
| one of the channels defined in the "channels" configuration array. |
||||
| |
||||
*/ |
||||
|
||||
'default' => 'custom', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Log Channels |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may configure the log channels for your application. Out of |
||||
| the box, Laravel uses the Monolog PHP logging library. This gives |
||||
| you a variety of powerful log handlers / formatters to utilize. |
||||
| |
||||
| Available Drivers: "single", "daily", "slack", "syslog", |
||||
| "errorlog", "monolog", |
||||
| "custom", "stack" |
||||
| |
||||
*/ |
||||
|
||||
'channels' => [ |
||||
'custom' => [ |
||||
'driver' => 'custom', |
||||
'via' => App\Logger::class, |
||||
], |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,123 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Mail Driver |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Laravel supports both SMTP and PHP's "mail" function as drivers for the |
||||
| sending of e-mail. You may specify which one you're using throughout |
||||
| your application here. By default, Laravel is setup for SMTP mail. |
||||
| |
||||
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", |
||||
| "sparkpost", "log", "array" |
||||
| |
||||
*/ |
||||
|
||||
'driver' => env('MAIL_DRIVER', 'smtp'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| SMTP Host Address |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may provide the host address of the SMTP server used by your |
||||
| applications. A default option is provided that is compatible with |
||||
| the Mailgun mail service which will provide reliable deliveries. |
||||
| |
||||
*/ |
||||
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| SMTP Host Port |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This is the SMTP port used by your application to deliver e-mails to |
||||
| users of the application. Like the host we have set this value to |
||||
| stay compatible with the Mailgun e-mail application by default. |
||||
| |
||||
*/ |
||||
|
||||
'port' => env('MAIL_PORT', 587), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Global "From" Address |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| You may wish for all e-mails sent by your application to be sent from |
||||
| the same address. Here, you may specify a name and address that is |
||||
| used globally for all e-mails that are sent by your application. |
||||
| |
||||
*/ |
||||
|
||||
'from' => [ |
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), |
||||
'name' => env('MAIL_FROM_NAME', 'Example'), |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| E-Mail Encryption Protocol |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the encryption protocol that should be used when |
||||
| the application send e-mail messages. A sensible default using the |
||||
| transport layer security protocol should provide great security. |
||||
| |
||||
*/ |
||||
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| SMTP Server Username |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| If your SMTP server requires a username for authentication, you should |
||||
| set it here. This will get used to authenticate with your server on |
||||
| connection. You may also set the "password" value below this one. |
||||
| |
||||
*/ |
||||
|
||||
'username' => env('MAIL_USERNAME'), |
||||
|
||||
'password' => env('MAIL_PASSWORD'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Sendmail System Path |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When using the "sendmail" driver to send e-mails, we will need to know |
||||
| the path to where Sendmail lives on this server. A default path has |
||||
| been provided here, which will work well on most of your systems. |
||||
| |
||||
*/ |
||||
|
||||
'sendmail' => '/usr/sbin/sendmail -bs', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Markdown Mail Settings |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| If you are using Markdown based email rendering, you may configure your |
||||
| theme and component paths here, allowing you to customize the design |
||||
| of the emails. Or, you may simply stick with the Laravel defaults! |
||||
| |
||||
*/ |
||||
|
||||
'markdown' => [ |
||||
'theme' => 'default', |
||||
|
||||
'paths' => [ |
||||
resource_path('views/vendor/mail'), |
||||
], |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,86 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Queue Connection Name |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Laravel's queue API supports an assortment of back-ends via a single |
||||
| API, giving you convenient access to each back-end using the same |
||||
| syntax for every one. Here you may define a default connection. |
||||
| |
||||
*/ |
||||
|
||||
'default' => env('QUEUE_DRIVER', 'sync'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Queue Connections |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may configure the connection information for each server that |
||||
| is used by your application. A default configuration has been added |
||||
| for each back-end shipped with Laravel. You are free to add more. |
||||
| |
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" |
||||
| |
||||
*/ |
||||
|
||||
'connections' => [ |
||||
|
||||
'sync' => [ |
||||
'driver' => 'sync', |
||||
], |
||||
|
||||
'database' => [ |
||||
'driver' => 'database', |
||||
'table' => 'jobs', |
||||
'queue' => 'default', |
||||
'retry_after' => 90, |
||||
], |
||||
|
||||
'beanstalkd' => [ |
||||
'driver' => 'beanstalkd', |
||||
'host' => 'localhost', |
||||
'queue' => 'default', |
||||
'retry_after' => 90, |
||||
], |
||||
|
||||
'sqs' => [ |
||||
'driver' => 'sqs', |
||||
'key' => env('SQS_KEY', 'your-public-key'), |
||||
'secret' => env('SQS_SECRET', 'your-secret-key'), |
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), |
||||
'queue' => env('SQS_QUEUE', 'your-queue-name'), |
||||
'region' => env('SQS_REGION', 'us-east-1'), |
||||
], |
||||
|
||||
'redis' => [ |
||||
'driver' => 'redis', |
||||
'connection' => 'default', |
||||
'queue' => 'default', |
||||
'retry_after' => 90, |
||||
'block_for' => null, |
||||
], |
||||
|
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Failed Queue Jobs |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| These options configure the behavior of failed queue job logging so you |
||||
| can control which database and table are used to store the jobs that |
||||
| have failed. You may change them to any database / table you wish. |
||||
| |
||||
*/ |
||||
|
||||
'failed' => [ |
||||
'database' => env('DB_CONNECTION', 'mysql'), |
||||
'table' => 'failed_jobs', |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,38 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Third Party Services |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This file is for storing the credentials for third party services such |
||||
| as Stripe, Mailgun, SparkPost and others. This file provides a sane |
||||
| default location for this type of information, allowing packages |
||||
| to have a conventional place to find your various credentials. |
||||
| |
||||
*/ |
||||
|
||||
'mailgun' => [ |
||||
'domain' => env('MAILGUN_DOMAIN'), |
||||
'secret' => env('MAILGUN_SECRET'), |
||||
], |
||||
|
||||
'ses' => [ |
||||
'key' => env('SES_KEY'), |
||||
'secret' => env('SES_SECRET'), |
||||
'region' => env('SES_REGION', 'us-east-1'), |
||||
], |
||||
|
||||
'sparkpost' => [ |
||||
'secret' => env('SPARKPOST_SECRET'), |
||||
], |
||||
|
||||
'stripe' => [ |
||||
'model' => \App\Models\User::class, |
||||
'key' => env('STRIPE_KEY'), |
||||
'secret' => env('STRIPE_SECRET'), |
||||
], |
||||
|
||||
]; |
@ -0,0 +1,197 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Default Session Driver |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option controls the default session "driver" that will be used on |
||||
| requests. By default, we will use the lightweight native driver but |
||||
| you may specify any of the other wonderful drivers provided here. |
||||
| |
||||
| Supported: "file", "cookie", "database", "apc", |
||||
| "memcached", "redis", "array" |
||||
| |
||||
*/ |
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Lifetime |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify the number of minutes that you wish the session |
||||
| to be allowed to remain idle before it expires. If you want them |
||||
| to immediately expire on the browser closing, set that option. |
||||
| |
||||
*/ |
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120), |
||||
|
||||
'expire_on_close' => false, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Encryption |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option allows you to easily specify that all of your session data |
||||
| should be encrypted before it is stored. All encryption will be run |
||||
| automatically by Laravel and you can use the Session like normal. |
||||
| |
||||
*/ |
||||
|
||||
'encrypt' => false, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session File Location |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When using the native session driver, we need a location where session |
||||
| files may be stored. A default has been set for you but a different |
||||
| location may be specified. This is only needed for file sessions. |
||||
| |
||||
*/ |
||||
|
||||
'files' => storage_path('framework/sessions'), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Database Connection |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When using the "database" or "redis" session drivers, you may specify a |
||||
| connection that should be used to manage these sessions. This should |
||||
| correspond to a connection in your database configuration options. |
||||
| |
||||
*/ |
||||
|
||||
'connection' => null, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Database Table |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When using the "database" session driver, you may specify the table we |
||||
| should use to manage the sessions. Of course, a sensible default is |
||||
| provided for you; however, you are free to change this as needed. |
||||
| |
||||
*/ |
||||
|
||||
'table' => 'sessions', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Cache Store |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When using the "apc" or "memcached" session drivers, you may specify a |
||||
| cache store that should be used for these sessions. This value must |
||||
| correspond with one of the application's configured cache stores. |
||||
| |
||||
*/ |
||||
|
||||
'store' => null, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Sweeping Lottery |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Some session drivers must manually sweep their storage location to get |
||||
| rid of old sessions from storage. Here are the chances that it will |
||||
| happen on a given request. By default, the odds are 2 out of 100. |
||||
| |
||||
*/ |
||||
|
||||
'lottery' => [2, 100], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Cookie Name |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may change the name of the cookie used to identify a session |
||||
| instance by ID. The name specified here will get used every time a |
||||
| new session cookie is created by the framework for every driver. |
||||
| |
||||
*/ |
||||
|
||||
'cookie' => env( |
||||
'SESSION_COOKIE', |
||||
str_slug(env('APP_NAME', 'laravel'), '_').'_session' |
||||
), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Cookie Path |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The session cookie path determines the path for which the cookie will |
||||
| be regarded as available. Typically, this will be the root path of |
||||
| your application but you are free to change this when necessary. |
||||
| |
||||
*/ |
||||
|
||||
'path' => '/', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Session Cookie Domain |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may change the domain of the cookie used to identify a session |
||||
| in your application. This will determine which domains the cookie is |
||||
| available to in your application. A sensible default has been set. |
||||
| |
||||
*/ |
||||
|
||||
'domain' => env('SESSION_DOMAIN', null), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| HTTPS Only Cookies |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| By setting this option to true, session cookies will only be sent back |
||||
| to the server if the browser has a HTTPS connection. This will keep |
||||
| the cookie from being sent to you if it can not be done securely. |
||||
| |
||||
*/ |
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE', false), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| HTTP Access Only |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Setting this value to true will prevent JavaScript from accessing the |
||||
| value of the cookie and the cookie will only be accessible through |
||||
| the HTTP protocol. You are free to modify this option if needed. |
||||
| |
||||
*/ |
||||
|
||||
'http_only' => true, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Same-Site Cookies |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option determines how your cookies behave when cross-site requests |
||||
| take place, and can be used to mitigate CSRF attacks. By default, we |
||||
| do not enable this as other CSRF protection services are in place. |
||||
| |
||||
| Supported: "lax", "strict" |
||||
| |
||||
*/ |
||||
|
||||
'same_site' => null, |
||||
|
||||
]; |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| View Storage Paths |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Most templating systems load templates from disk. Here you may specify |
||||
| an array of paths that should be checked for your views. Of course |
||||
| the usual Laravel view path has already been registered for you. |
||||
| |
||||
*/ |
||||
|
||||
'paths' => [ |
||||
resource_path('views'), |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Compiled View Path |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This option determines where all the compiled Blade templates will be |
||||
| stored for your application. Typically, this is within the storage |
||||
| directory. However, as usual, you are free to change this value. |
||||
| |
||||
*/ |
||||
|
||||
'compiled' => realpath(storage_path('framework/views')), |
||||
|
||||
]; |
@ -0,0 +1 @@ |
||||
*.sqlite |
@ -0,0 +1,23 @@ |
||||
<?php |
||||
|
||||
use Faker\Generator as Faker; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Model Factories |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This directory should contain each of the model factory definitions for |
||||
| your application. Factories provide a convenient way to generate new |
||||
| model instances for testing / seeding your application's database. |
||||
| |
||||
*/ |
||||
|
||||
$factory->define(\App\Models\User::class, function (Faker $faker) { |
||||
return [ |
||||
'name' => $faker->name, |
||||
'email' => $faker->unique()->safeEmail, |
||||
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret |
||||
'remember_token' => str_random(10), |
||||
]; |
||||
}); |
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Support\Facades\Schema; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Database\Migrations\Migration; |
||||
|
||||
class CreateUsersTable extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('users', function (Blueprint $table) { |
||||
$table->increments('id'); |
||||
$table->string('name'); |
||||
$table->string('email')->unique(); |
||||
$table->string('password'); |
||||
$table->rememberToken(); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('users'); |
||||
} |
||||
} |
@ -0,0 +1,32 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Support\Facades\Schema; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Database\Migrations\Migration; |
||||
|
||||
class CreatePasswordResetsTable extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('password_resets', function (Blueprint $table) { |
||||
$table->string('email')->index(); |
||||
$table->string('token'); |
||||
$table->timestamp('created_at')->nullable(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('password_resets'); |
||||
} |
||||
} |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Seeder; |
||||
|
||||
class DatabaseSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Seed the application's database. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function run() |
||||
{ |
||||
// $this->call(UsersTableSeeder::class); |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@ |
||||
{ |
||||
"private": true, |
||||
"scripts": { |
||||
"dev": "npm run development", |
||||
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", |
||||
"watch": "npm run development -- --watch", |
||||
"watch-poll": "npm run watch -- --watch-poll", |
||||
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js", |
||||
"prod": "npm run production", |
||||
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" |
||||
}, |
||||
"devDependencies": { |
||||
"axios": "^0.18", |
||||
"bootstrap": "^4.0.0", |
||||
"popper.js": "^1.12", |
||||
"cross-env": "^5.1", |
||||
"jquery": "^3.2", |
||||
"laravel-mix": "^2.0", |
||||
"lodash": "^4.17.4", |
||||
"vue": "^2.5.7" |
||||
} |
||||
} |
@ -0,0 +1,14 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
find 'vendor_patches' -name '*.patch' | sort | while read f; do |
||||
# If we could reverse the patch, then it has already been applied; skip it |
||||
if patch --dry-run --reverse --force -p0 -N -i "$f" >/dev/null 2>&1; then |
||||
echo -e "\e[32m[i] Patch \"$f\" already applied - skipping.\e[m" >&2 |
||||
else # patch not yet applied |
||||
echo -e "\e[33m[i] Applying patch \"$f\"...\e[m" |
||||
patch -p0 -N -i "$f" || echo -e "\e[31;1mPatch \"$f\" failed\e[m" >&2 |
||||
fi |
||||
#patch -p0 -N -i "$f" |
||||
done; |
||||
|
||||
echo "Patches applied." |
@ -0,0 +1,33 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<phpunit backupGlobals="false" |
||||
backupStaticAttributes="false" |
||||
bootstrap="vendor/autoload.php" |
||||
colors="true" |
||||
convertErrorsToExceptions="true" |
||||
convertNoticesToExceptions="true" |
||||
convertWarningsToExceptions="true" |
||||
processIsolation="false" |
||||
stopOnFailure="false"> |
||||
<testsuites> |
||||
<testsuite name="Unit"> |
||||
<directory suffix="Test.php">./tests/Unit</directory> |
||||
</testsuite> |
||||
|
||||
<testsuite name="Feature"> |
||||
<directory suffix="Test.php">./tests/Feature</directory> |
||||
</testsuite> |
||||
</testsuites> |
||||
<filter> |
||||
<whitelist processUncoveredFilesFromWhitelist="true"> |
||||
<directory suffix=".php">./app</directory> |
||||
</whitelist> |
||||
</filter> |
||||
<php> |
||||
<env name="APP_ENV" value="testing"/> |
||||
<env name="BCRYPT_ROUNDS" value="4"/> |
||||
<env name="CACHE_DRIVER" value="array"/> |
||||
<env name="SESSION_DRIVER" value="array"/> |
||||
<env name="QUEUE_DRIVER" value="sync"/> |
||||
<env name="MAIL_DRIVER" value="array"/> |
||||
</php> |
||||
</phpunit> |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* 'Access denied' kind of exception |
||||
*/ |
||||
class AccessException extends RuntimeException |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* Wrong method arguments passed. |
||||
*/ |
||||
class ArgumentException extends RuntimeException |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
trait ExceptionConstructorTrait |
||||
{ |
||||
/** |
||||
* Create from (Cause), or (Message, Cause). |
||||
* Cause is Exception. |
||||
* |
||||
* @param mixed $arg1 Cause, or Message if second arg is Cause |
||||
* @param mixed|null $arg2 Cause |
||||
*/ |
||||
public function __construct($arg1 = null, $arg2 = null) |
||||
{ |
||||
$cause = null; |
||||
$message = ""; |
||||
if ($arg1 instanceof \Exception) { |
||||
// Invoked without a message, only cause |
||||
$cause = $arg1; |
||||
$message = $cause->getMessage(); // Repeat the message so it's easy to see in the logs |
||||
} elseif (is_string($arg1)) { |
||||
// First is message |
||||
$message = $arg1; |
||||
// Second, optional, is a cause |
||||
if ($arg2 instanceof \Exception) { |
||||
$cause = $arg2; |
||||
} |
||||
} |
||||
// call Exception constructor |
||||
parent::__construct($message, 0, $cause); |
||||
} |
||||
} |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* Malformed config field, invalid syntax |
||||
*/ |
||||
class FormatException extends RuntimeException |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* Something that should exist, doesn't |
||||
*/ |
||||
class NotExistException extends RuntimeException |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* tried to run a method that's not implemented yet. |
||||
*/ |
||||
class NotImplementedException extends RuntimeException |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,11 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
/** |
||||
* Custom exception that happens rarely and does not need to be handled explicitly. |
||||
*/ |
||||
abstract class RuntimeException extends \RuntimeException |
||||
{ |
||||
use ExceptionConstructorTrait; |
||||
} |
@ -0,0 +1,14 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Exceptions; |
||||
|
||||
class ViewException extends RuntimeException |
||||
{ |
||||
public $captured; |
||||
|
||||
public function __construct(\Exception $cause, $captured) |
||||
{ |
||||
$this->captured = $captured; |
||||
parent::__construct($cause); |
||||
} |
||||
} |
@ -0,0 +1,87 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Providers; |
||||
|
||||
use Blade; |
||||
use Illuminate\Support\ServiceProvider; |
||||
|
||||
class BladeExtensionsProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* Parse argument of a blade directive |
||||
* |
||||
* @param string $x argument received by a blade directive |
||||
* @return array the arguments (strings without quotes) |
||||
*/ |
||||
private static function parseBladeArgs($x) |
||||
{ |
||||
// strip wrapping parens |
||||
return array_map('trim', str_getcsv($x)); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Add blade directives |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
// @faker(text, 100) |
||||
Blade::directive('faker', function ($x) { |
||||
$args = self::parseBladeArgs($x); |
||||
|
||||
$method = $args[0]; |
||||
$params = count($args) > 1 ? $args[1] : ''; |
||||
|
||||
return "<?= e(app()->make('\\Faker\\Generator')->$method($params)) ?>";
|
||||
}); |
||||
|
||||
// csrf token for forms |
||||
Blade::directive('formCsrf', function () { |
||||
return '<?= csrf_field() ?>';
|
||||
}); |
||||
|
||||
// json encode |
||||
Blade::directive('json', function ($x) { |
||||
if (config('app.pretty_json')) { |
||||
return "<?= json_encode(($x), JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES) ?>";
|
||||
} else { |
||||
return "<?= json_encode(($x), JSON_UNESCAPED_SLASHES) ?>";
|
||||
} |
||||
}); |
||||
|
||||
// json encode, escaped |
||||
Blade::directive('jsone', function ($x) { |
||||
if (config('app.pretty_json')) { |
||||
return "<?= e(json_encode(($x), JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)) ?>";
|
||||
} else { |
||||
return "<?= e(json_encode(($x), JSON_UNESCAPED_SLASHES)) ?>";
|
||||
} |
||||
}); |
||||
|
||||
// selected if cond true |
||||
Blade::directive('selected', function ($x) { |
||||
return "<?= ($x) ? 'selected' : '' ?>";
|
||||
}); |
||||
|
||||
// checked if cond true |
||||
Blade::directive('checked', function ($x) { |
||||
return "<?= ($x) ? 'checked' : '' ?>";
|
||||
}); |
||||
|
||||
Blade::if('admin', function () { |
||||
return \Auth::user()->isAdmin(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Register any application services. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function register() |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,152 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Providers; |
||||
|
||||
use Illuminate\Support\Arr; |
||||
use Illuminate\Support\Collection; |
||||
use Illuminate\Support\ServiceProvider; |
||||
|
||||
/** |
||||
* Register macros |
||||
*/ |
||||
class MacroServiceProvider extends ServiceProvider |
||||
{ |
||||
/** |
||||
* Bootstrap the application services. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function boot() |
||||
{ |
||||
/** Natural ordering */ |
||||
Collection::macro('natSortBy', function ($callback, $caseSensitive = false) { |
||||
$results = []; |
||||
|
||||
$callback = $this->valueRetriever($callback); |
||||
|
||||
// First we will loop through the items and get the comparator from a callback |
||||
// function which we were given. Then, we will sort the returned values and |
||||
// and grab the corresponding values for the sorted keys from this array. |
||||
try { |
||||
foreach ($this->items as $key => $value) { |
||||
$results[$key] = iconv('UTF-8', 'ASCII//TRANSLIT', $callback($value, $key)); |
||||
} |
||||
} catch (\ErrorException $e) { |
||||
// some iconv versions do not support translit of UTF-8 |
||||
foreach ($this->items as $key => $value) { |
||||
$results[$key] = simple_translit($callback($value, $key)); |
||||
} |
||||
} |
||||
|
||||
uasort($results, $caseSensitive ? 'strnatcmp' : 'strnatcasecmp'); |
||||
|
||||
// Once we have sorted all of the keys in the array, we will loop through them |
||||
// and grab the corresponding model so we can set the underlying items list |
||||
// to the sorted version. Then we'll just return the collection instance. |
||||
foreach (array_keys($results) as $key) { |
||||
$results[$key] = $this->items[$key]; |
||||
} |
||||
|
||||
return new static($results); |
||||
}); |
||||
|
||||
|
||||
/** Natural ordering - for strings */ |
||||
Collection::macro('natSort', function ($caseSensitive = false) { |
||||
$results = []; |
||||
|
||||
// First we will loop through the items and get the comparator from a callback |
||||
// function which we were given. Then, we will sort the returned values and |
||||
// and grab the corresponding values for the sorted keys from this array. |
||||
try { |
||||
foreach ($this->items as $key => $value) { |
||||
$results[$key] = iconv('UTF-8', 'ASCII//TRANSLIT', $value); |
||||
} |
||||
} catch (\ErrorException $e) { |
||||
// some iconv versions do not support translit of UTF-8 |
||||
foreach ($this->items as $key => $value) { |
||||
$results[$key] = simple_translit($value); |
||||
} |
||||
} |
||||
|
||||
uasort($results, $caseSensitive ? 'strnatcmp' : 'strnatcasecmp'); |
||||
|
||||
// Once we have sorted all of the keys in the array, we will loop through them |
||||
// and grab the corresponding model so we can set the underlying items list |
||||
// to the sorted version. Then we'll just return the collection instance. |
||||
foreach (array_keys($results) as $key) { |
||||
$results[$key] = $this->items[$key]; |
||||
} |
||||
|
||||
return new static($results); |
||||
}); |
||||
|
||||
|
||||
/** Use this array as keys, callback to produce values */ |
||||
Collection::macro('asKeys', function ($callback) { |
||||
$results = []; |
||||
|
||||
$callback = $this->valueRetriever($callback); |
||||
|
||||
foreach ($this->items as $value) { |
||||
$results[$value] = $callback($value); |
||||
} |
||||
|
||||
return new static($results); |
||||
}); |
||||
|
||||
|
||||
/** Trim all strings */ |
||||
Collection::macro('trim', function () { |
||||
return $this->map(function($x) { |
||||
return trim($x); |
||||
}); |
||||
}); |
||||
|
||||
/** Trim all strings */ |
||||
Collection::macro('without', function ($keys) { |
||||
if (!is_array($keys)) $keys = [$keys]; |
||||
return $this->filter(function($v, $k) use($keys) { |
||||
return !in_array($k, $keys); |
||||
}); |
||||
}); |
||||
|
||||
// --- kpluck --- |
||||
|
||||
Arr::macro('kpluck', function ($array, $value, $key) { |
||||
$results = []; |
||||
|
||||
list($value, $key) = static::explodePluckParameters($value, $key); |
||||
|
||||
foreach ($array as $origKey => $item) { |
||||
$itemValue = data_get($item, $value); |
||||
|
||||
// THIS was changed to use origKey |
||||
if (is_null($key)) { |
||||
$results[$origKey] = $itemValue; |
||||
} else { |
||||
$itemKey = data_get($item, $key); |
||||
|
||||
$results[$itemKey] = $itemValue; |
||||
} |
||||
} |
||||
|
||||
return $results; |
||||
}); |
||||
|
||||
/** Pluck, but preserving keys. Single level only! */ |
||||
Collection::macro('kpluck', function ($value, $key = null) { |
||||
return new Collection(Arr::kpluck($this->items, $value, $key)); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Register the application services. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function register() |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,85 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
|
||||
use MightyPork\Exceptions\NotExistException; |
||||
use ReflectionClass; |
||||
|
||||
/** Trait for checking if const is defined in class */ |
||||
trait Enum |
||||
{ |
||||
private static $cache_enum_constants = null; |
||||
|
||||
/** |
||||
* Get all constants |
||||
* |
||||
* @param string $prefix required name prefix (filter) |
||||
* @return array name -> value array |
||||
*/ |
||||
public static function getConstants($prefix = '') |
||||
{ |
||||
if (static::$cache_enum_constants != null) return static::$cache_enum_constants; |
||||
|
||||
$map = (new ReflectionClass(static::class))->getConstants(); |
||||
$selected = []; |
||||
foreach ($map as $k => $v) { |
||||
if ($prefix === '' || strpos($k, $prefix) === 0) { |
||||
$selected[$k] = $v; |
||||
} |
||||
} |
||||
|
||||
static::$cache_enum_constants = $selected; |
||||
return $selected; |
||||
} |
||||
|
||||
/** |
||||
* Check if a constant with a given value is defined in this class. |
||||
* |
||||
* @param mixed $value checked value |
||||
* @param string $prefix required name prefix |
||||
* @return bool |
||||
*/ |
||||
public static function isDefined($value, $prefix = '') |
||||
{ |
||||
return in_array($value, static::getConstants($prefix)); |
||||
} |
||||
|
||||
/** |
||||
* Check if a constant with a given name is defined in this class. |
||||
* |
||||
* @param string $name checked name |
||||
* @param string $prefix required name prefix |
||||
* @return bool |
||||
*/ |
||||
public static function hasConstant($name, $prefix = '') |
||||
{ |
||||
return array_key_exists($name, static::getConstants($prefix)); |
||||
} |
||||
|
||||
/** |
||||
* Get constant value dynamically by name |
||||
* |
||||
* @param string $name |
||||
* @return mixed |
||||
*/ |
||||
public static function forName($name) |
||||
{ |
||||
return constant(static::class . '::' . $name); |
||||
} |
||||
|
||||
/** |
||||
* Get constant name by it's value |
||||
* |
||||
* @param mixed $value |
||||
* @return string |
||||
*/ |
||||
public static function nameOf($value) |
||||
{ |
||||
$k = array_search($value, static::getConstants()); |
||||
|
||||
if ($k == false) |
||||
throw new NotExistException("Invalid value '$value' for enum " . static::class); |
||||
|
||||
return $k; |
||||
} |
||||
} |
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
|
||||
use MightyPork\Exceptions\NotExistException; |
||||
use Illuminate\Support\Collection; |
||||
|
||||
/** |
||||
* Improved collection with object access to fields |
||||
*/ |
||||
class ObjCollection extends Collection |
||||
{ |
||||
public function __get($name) |
||||
{ |
||||
if (isset($this[$name])) return $this[$name]; |
||||
|
||||
throw new NotExistException("No '$name' in collection."); |
||||
} |
||||
|
||||
public function __isset($name) |
||||
{ |
||||
return isset($this[$name]); |
||||
} |
||||
|
||||
public function __set($name, $value) |
||||
{ |
||||
$this[$name] = $value; |
||||
} |
||||
} |
@ -0,0 +1,44 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
|
||||
|
||||
/** |
||||
* Profiling funcs |
||||
*/ |
||||
class Profiler |
||||
{ |
||||
/** |
||||
* Get current time |
||||
* |
||||
* @return float time (s) |
||||
*/ |
||||
public static function now() |
||||
{ |
||||
list($usec, $sec) = explode(" ", microtime()); |
||||
return ((float) $usec + (float) $sec); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Start profiling |
||||
* |
||||
* @return float current time (profiling token) |
||||
*/ |
||||
public static function start() |
||||
{ |
||||
return self::now(); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Measure time elapsed since start, formatted to 3 decimal places for printing. |
||||
* |
||||
* @param float $start time obtained with "start()" |
||||
* @return float time elapsed (s) |
||||
*/ |
||||
public static function end($start) |
||||
{ |
||||
return sprintf('%0.3f', self::now() - $start); |
||||
} |
||||
} |
@ -0,0 +1,413 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
use Lang; |
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate; |
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet; |
||||
use PhpOffice\PhpSpreadsheet\Style\Fill; |
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; |
||||
use PhpOffice\PhpSpreadsheet\Writer\IWriter; |
||||
|
||||
/** |
||||
* Abstraction above PhpOffice's spreadsheets with stable API. |
||||
* Fixing incompatibilities in one place will fix them in the entire application. |
||||
*/ |
||||
class SpreadsheetBuilder |
||||
{ |
||||
private $activeSheetNum = -1; |
||||
private $sheetCount = 0; |
||||
|
||||
/** @var Spreadsheet Spreadsheet */ |
||||
private $book = null; |
||||
|
||||
/** @var Worksheet */ |
||||
private $activeSheet = null; |
||||
|
||||
/** @var string - document title */ |
||||
private $title; |
||||
|
||||
public function __construct($title, $subject = '', $creator='PhpOffice Spreadsheet') |
||||
{ |
||||
$this->title = $title; |
||||
$this->book = new Spreadsheet(); |
||||
|
||||
$this->book->getProperties() |
||||
->setCreator($creator) |
||||
->setTitle($title) |
||||
->setSubject($subject) |
||||
->setDescription('Created ' . date('r')); |
||||
} |
||||
|
||||
/** |
||||
* @return string |
||||
*/ |
||||
public function getTitle() |
||||
{ |
||||
return $this->title; |
||||
} |
||||
|
||||
/** |
||||
* Add a sheet and select it as active. |
||||
* Returns sheet index. |
||||
* |
||||
* @param $label - sheet label |
||||
* @return int - new sheet number, 0-based |
||||
*/ |
||||
public function addSheet($label) |
||||
{ |
||||
if ($this->activeSheetNum == -1) { |
||||
// PhpOffice workbook has one sheet by default, |
||||
// we require user to 'add' it before using it |
||||
$this->sheetCount = 1; |
||||
$this->activeSheet = $this->book->setActiveSheetIndex(0); |
||||
$this->activeSheetNum = 0; |
||||
} |
||||
else { |
||||
$this->sheetCount++; |
||||
$this->activeSheet = $this->book->addSheet(new Worksheet()); |
||||
$this->activeSheetNum = $this->sheetCount-1; |
||||
} |
||||
|
||||
$this->activeSheet->setTitle($label); |
||||
return $this->activeSheetNum; |
||||
} |
||||
|
||||
/** |
||||
* Select a sheet for cell modifications |
||||
* |
||||
* @param int $number - sheet index, 0-based |
||||
*/ |
||||
public function selectSheet($number) |
||||
{ |
||||
$this->activeSheet = $this->book->setActiveSheetIndex($number); |
||||
$this->activeSheetNum = $number; |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Set a cell value in the current sheet |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $column - 0-based column |
||||
* @param mixed $value - value to set |
||||
*/ |
||||
public function setValue($row, $column, $value) |
||||
{ |
||||
$this->activeSheet->setCellValueByColumnAndRow($column+1, $row+1, $value); |
||||
} |
||||
|
||||
/** |
||||
* Set a row of values |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $startcol - first column to fill |
||||
* @param array $values - array of values to write into the row |
||||
*/ |
||||
public function setRow($row, $startcol, $values) |
||||
{ |
||||
$i = 0; |
||||
foreach ($values as $value) { |
||||
$this->setValue($row, $startcol + $i, $value); |
||||
$i++; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Set a row of values |
||||
* |
||||
* @param int $startrow - 0-based start row |
||||
* @param int $startcol - 0-based start column |
||||
* @param array $values - array of row vectors ([ [first,row], [second,row], ...] |
||||
*/ |
||||
public function setGrid($startrow, $startcol, $values) |
||||
{ |
||||
foreach ($values as $row => $row_values) { |
||||
$this->setRow($startrow + $row, $startcol, $row_values); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Make a cell a given style |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $column - 0-based column |
||||
*/ |
||||
private function setStyle($row, $column, $array) |
||||
{ |
||||
$coord = Coordinate::stringFromColumnIndex($column+1) . ($row+1); |
||||
|
||||
$this->activeSheet->getStyle($coord) |
||||
->applyFromArray($array); |
||||
} |
||||
|
||||
/** |
||||
* Make an area of cells a given style |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
*/ |
||||
private function setStyleArea($startrow, $startcol, $rows, $cols, $array) |
||||
{ |
||||
$coord = Coordinate::stringFromColumnIndex($startcol+1) . ($startrow+1) . |
||||
':' . Coordinate::stringFromColumnIndex($startcol+$cols) . ($startrow+$rows); |
||||
|
||||
$this->activeSheet->getStyle($coord) |
||||
->applyFromArray($array); |
||||
} |
||||
|
||||
/** |
||||
* Make a cell bold |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $column - 0-based column |
||||
*/ |
||||
public function setBold($row, $column) |
||||
{ |
||||
$this->setStyle($row, $column, ['font' => ['bold' => 'true']]); |
||||
} |
||||
|
||||
/** |
||||
* Make an area of cells bold |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
*/ |
||||
public function setBoldArea($startrow, $startcol, $rows, $cols) |
||||
{ |
||||
$this->setStyleArea($startrow, $startcol, $rows, $cols, ['font' => ['bold' => 'true']]); |
||||
} |
||||
|
||||
/** |
||||
* Make a cell italic |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $column - 0-based column |
||||
*/ |
||||
public function setItalic($row, $column) |
||||
{ |
||||
$this->setStyle($row, $column, ['font' => ['italic' => 'true']]); |
||||
} |
||||
|
||||
/** |
||||
* Make an area of cells italic |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
*/ |
||||
public function setItalicArea($startrow, $startcol, $rows, $cols) |
||||
{ |
||||
$this->setStyleArea($startrow, $startcol, $rows, $cols, ['font' => ['italic' => 'true']]); |
||||
} |
||||
|
||||
private function convertColor($color) |
||||
{ |
||||
if ($color[0] == '#') $rgb = substr($color, 1); |
||||
else { |
||||
$map = [ |
||||
'black' => '000000', |
||||
'gray' => '808080', |
||||
'silver' => 'C0C0C0', |
||||
'white' => 'FFFFFF', |
||||
'maroon' => '800000', |
||||
'red' => 'FF0000', |
||||
'olive' => '808000', |
||||
'yellow' => 'FFFF00', |
||||
'green' => '008000', |
||||
'lime' => '00FF00', |
||||
'teal' => '008080', |
||||
'aqua' => '00FFFF', |
||||
'navy' => '000080', |
||||
'blue' => '0000FF', |
||||
'purple' => '800080', |
||||
'fuchsia' => 'FF00FF', |
||||
]; |
||||
|
||||
if (isset($map[$color])) { |
||||
$rgb = $map[$color]; |
||||
} else { |
||||
throw new \LogicException("Bad color format $color"); |
||||
} |
||||
} |
||||
|
||||
return ['rgb' => $rgb]; |
||||
} |
||||
|
||||
/** |
||||
* Set cell colors |
||||
* |
||||
* @param int $row - 0-based row |
||||
* @param int $column - 0-based column |
||||
* @param string $text - foreground |
||||
* @param string $background - background |
||||
*/ |
||||
public function setColors($row, $column, $text = null, $background = null) |
||||
{ |
||||
$this->setColorsArea($row, $column, 1, 1, $text, $background); |
||||
} |
||||
|
||||
/** |
||||
* Set colors of an area of cells |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
* @param string $text - foreground |
||||
* @param string $background - background |
||||
*/ |
||||
public function setColorsArea($startrow, $startcol, $rows, $cols, $text = null, $background = null) |
||||
{ |
||||
$ar = []; |
||||
|
||||
if ($text !== null) { |
||||
$ar['font'] = [ |
||||
'color' => $this->convertColor($text), |
||||
]; |
||||
} |
||||
|
||||
if ($background !== null) { |
||||
$ar['fill'] = [ |
||||
'fillType' => Fill::FILL_SOLID, |
||||
'color' => $this->convertColor($background), |
||||
]; |
||||
} |
||||
|
||||
$this->setStyleArea($startrow, $startcol, $rows, $cols, $ar); |
||||
} |
||||
|
||||
/** |
||||
* Merge cells |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
*/ |
||||
public function mergeCells($startrow, $startcol, $rows, $cols) |
||||
{ |
||||
$coord = Coordinate::stringFromColumnIndex($startcol+1) . ($startrow+1) . |
||||
':' . Coordinate::stringFromColumnIndex($startcol+$cols) . ($startrow+$rows); |
||||
|
||||
$this->activeSheet->mergeCells($coord); |
||||
} |
||||
|
||||
/** |
||||
* Merge row cells |
||||
* |
||||
* @param $startrow - 0-based first row |
||||
* @param $startcol - 0-based first column |
||||
* @param $rows - number of rows |
||||
* @param $cols - number of columns |
||||
*/ |
||||
public function mergeRowCells($startrow, $startcol, $cols) |
||||
{ |
||||
$this->mergeCells($startrow, $startcol, 1, $cols); |
||||
} |
||||
|
||||
/** |
||||
* Set a column's width |
||||
* |
||||
* @param int $column - 0-based column number |
||||
* @param int $width - width in pixels |
||||
*/ |
||||
public function setColumnWidth($column, $width) |
||||
{ |
||||
$this->activeSheet->getColumnDimensionByColumn($column+1)->setWidth($width); |
||||
} |
||||
|
||||
/** |
||||
* Prepare writer and resolve mime type for export |
||||
* |
||||
* @param string $format - one of : xls, xlsx, csv, ods |
||||
* @return array (mime, writer) |
||||
*/ |
||||
private function prepareExport($format = 'xlsx') |
||||
{ |
||||
switch ($format) { |
||||
case 'xls': |
||||
$writerName = 'Xls'; |
||||
$mimeType = 'application/vnd.ms-excel'; |
||||
break; |
||||
|
||||
case 'xlsx': |
||||
$writerName = 'Xlsx'; |
||||
$mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; |
||||
break; |
||||
|
||||
case 'ods': |
||||
$writerName = 'Ods'; |
||||
$mimeType = 'application/vnd.oasis.opendocument.spreadsheet'; |
||||
break; |
||||
|
||||
default: |
||||
case 'csv': |
||||
$writerName = 'Csv'; |
||||
$mimeType = 'text/csv'; |
||||
break; |
||||
} |
||||
|
||||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet |
||||
$this->book->setActiveSheetIndex(0); |
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->book, $writerName); |
||||
|
||||
return [$mimeType, $writer]; |
||||
} |
||||
|
||||
/** |
||||
* Export and send to browser as a response for user to download |
||||
* |
||||
* @param string $base_filename - filename without suffix |
||||
* @param string $format - one of : xls, xlsx, csv, ods |
||||
*/ |
||||
public function exportToBrowser($base_filename, $format = 'xlsx') |
||||
{ |
||||
list($mimeType, $writer) = $this->prepareExport($format); |
||||
|
||||
/** @var IWriter $writer */ |
||||
$base_filename .= '.' . $format; |
||||
|
||||
ob_end_clean(); |
||||
|
||||
// Redirect output to a client’s web browser (Xlsx) |
||||
header("Content-Type: $mimeType; charset=utf-8"); |
||||
header("Content-Disposition: attachment;filename=\"$base_filename\""); |
||||
header('Content-Language: ' . Lang::locale()); |
||||
|
||||
// Cache headers |
||||
|
||||
header('Cache-Control: max-age=0'); |
||||
// IE9 |
||||
header('Cache-Control: max-age=1'); |
||||
// Other IE headers |
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past |
||||
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified |
||||
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 |
||||
header('Pragma: no-cache'); // HTTP/1.0 |
||||
|
||||
$writer->save('php://output'); |
||||
exit; |
||||
} |
||||
|
||||
/** |
||||
* Export and send to browser as a response for user to download |
||||
* |
||||
* @param string $base_filename - filename without suffix |
||||
* @param string $format - one of : xls, xlsx, csv, ods |
||||
* @return string - the mime type |
||||
*/ |
||||
public function exportToFile($base_filename, $format = 'xlsx', $path='/tmp') |
||||
{ |
||||
list($mimeType, $writer) = $this->prepareExport($format); |
||||
|
||||
/** @var IWriter $writer */ |
||||
$writer->save($path . DIRECTORY_SEPARATOR . "$base_filename.$format"); |
||||
|
||||
return $mimeType; |
||||
} |
||||
} |
@ -0,0 +1,693 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
|
||||
use MightyPork\Exceptions\FormatException; |
||||
use Illuminate\Support\Collection; |
||||
use Log; |
||||
|
||||
class Str extends \Illuminate\Support\Str |
||||
{ |
||||
protected static $cty_snake_cache = []; |
||||
|
||||
/** |
||||
* Split and trim |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $haystack string to split |
||||
* @param string|string[] $delimiters delimiter |
||||
* @return array pieces, trimmed. |
||||
*/ |
||||
public static function splitTrim($haystack, $delimiters=[',', ';', '|']) |
||||
{ |
||||
$haystack = trim($haystack); |
||||
if (strlen($haystack) == 0) return []; |
||||
return array_map('trim', self::split($haystack, $delimiters)); |
||||
} |
||||
|
||||
/** |
||||
* Customized snake case for cty aliases |
||||
* |
||||
* @param $camel |
||||
* @return string |
||||
*/ |
||||
public static function snakeAlias($camel) |
||||
{ |
||||
if (isset(static::$cty_snake_cache[$camel])) |
||||
return static::$cty_snake_cache[$camel]; |
||||
|
||||
$c = $camel; |
||||
|
||||
$c = preg_replace_callback('/([A-Z0-9]+)(?![a-z])/', function ($m) { |
||||
return ucfirst(strtolower($m[1])); |
||||
}, $c); |
||||
|
||||
$c = self::snake($c, '_'); |
||||
|
||||
// fix for underscores in cty class name |
||||
$c = preg_replace('/_+/', '_', $c); |
||||
|
||||
return static::$cty_snake_cache[$camel] = $c; |
||||
} |
||||
|
||||
/** |
||||
* Split a string using one or more delimiters |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $haystack |
||||
* @param string|array $delimiters |
||||
* @return array |
||||
*/ |
||||
public static function split($haystack, $delimiters) |
||||
{ |
||||
if (is_string($delimiters)) { |
||||
return explode($delimiters, $haystack); |
||||
} |
||||
|
||||
// make sure it's array |
||||
if (!is_array($delimiters)) { |
||||
$delimiters = [$delimiters]; |
||||
} |
||||
|
||||
// helper |
||||
$regex_escape = function ($x) { |
||||
return preg_quote($x, '/'); |
||||
}; |
||||
|
||||
// compose splitting regex |
||||
$reg = "/" . implode('|', array_map($regex_escape, $delimiters)) . "/"; |
||||
|
||||
return preg_split($reg, $haystack); |
||||
} |
||||
|
||||
/** |
||||
* Split "CSV" string to items, trim each item. |
||||
* Empty values at start and end are discarded. |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $str |
||||
* @return array items |
||||
*/ |
||||
public static function splitCsv($str) |
||||
{ |
||||
return array_map('trim', explode(',', trim($str, ','))); |
||||
} |
||||
|
||||
/** |
||||
* Pad an integer to 2 digit |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param int $int the number |
||||
* @return string padded with zero |
||||
*/ |
||||
public static function pad2($int) |
||||
{ |
||||
return sprintf("%02d", $int); |
||||
} |
||||
|
||||
/** |
||||
* Remove diacritics from a string |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $str |
||||
* @return string ascii |
||||
*/ |
||||
public static function asciify($str) |
||||
{ |
||||
return iconv('UTF-8', 'US-ASCII//TRANSLIT', $str); |
||||
} |
||||
|
||||
/** |
||||
* Public for unit tests |
||||
* |
||||
* Convert mask to regex |
||||
* |
||||
* @param $mask |
||||
* @return mixed|string |
||||
*/ |
||||
public static function _pregMaskPrepare($mask) |
||||
{ |
||||
$mask = preg_quote($mask); |
||||
|
||||
// number = repeat |
||||
$mask = preg_replace('#(?<![.*+,{\d\\\\]|^)(\d+)#', '{$1}', $mask); // can repeat ? |
||||
|
||||
$mask = strtr($mask, [ |
||||
'\?' => '?', |
||||
'\*' => '*', |
||||
'\+' => '+', |
||||
'\{' => '{', |
||||
'\}' => '}', |
||||
'\(' => '(', |
||||
'\)' => ')', |
||||
'd' => '\d', |
||||
'F' => '-?\d+(\.\d+)?', |
||||
'D' => '-?\d+', |
||||
'a' => '[[:alpha:]]', |
||||
'\\\\' => '\\', |
||||
]); |
||||
|
||||
$mask = strtr($mask, [ |
||||
'\\\\' => '\\', |
||||
]); |
||||
|
||||
return $mask; |
||||
} |
||||
|
||||
/** |
||||
* Match a string against a mask. |
||||
* |
||||
* Special symbols: |
||||
* - `*` repeat previous any number of times |
||||
* - `?` previous is optional |
||||
* - `()` grouping |
||||
* - `a` alpha |
||||
* - `d` digit |
||||
* - `F` float value d, d.ddd with optional leading - |
||||
* - `+` repeat previous symbol any number of times |
||||
* - Number - repeat N times |
||||
* - {N}, {M,N} - repeat n times, like in regex |
||||
* |
||||
* Any other characters are matched literally. |
||||
* |
||||
* @param string $mask mask to match against |
||||
* @param string $string tested string |
||||
* @return bool matches |
||||
*/ |
||||
public static function maskMatch($mask, $string) |
||||
{ |
||||
$mask = self::_pregMaskPrepare($mask); |
||||
return 1 === preg_match('|^' . $mask . '$|u', $string); |
||||
} |
||||
|
||||
/** |
||||
* Format a string with {0} {foo} or {} |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $format |
||||
* @param array ...$args substitutions. Can also be an explicit array. |
||||
* @return string |
||||
*/ |
||||
public static function format($format, ...$args) |
||||
{ |
||||
$args = func_get_args(); |
||||
$format = array_shift($args); |
||||
|
||||
// explicit array given |
||||
if (is_array($args[0])) { |
||||
$args = $args[0]; |
||||
} |
||||
|
||||
$format = preg_replace_callback('#\{\}#', function () { |
||||
static $i = 0; |
||||
return '{' . ($i++) . '}'; |
||||
}, $format); |
||||
|
||||
return str_replace( |
||||
array_map(function ($k) { |
||||
return '{' . $k . '}'; |
||||
}, array_keys($args)), |
||||
|
||||
array_values($args), |
||||
|
||||
$format |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* Remove whitespace on the left side of a block. |
||||
* This function is quite expensive, so it's recommended |
||||
* to cache the result, if possible. |
||||
* |
||||
* <b>NOTE:</b> The current implementation converts all leading tabs to spaces. |
||||
* |
||||
* @param string $txt text to trim |
||||
* @param int $tab_size number of spaces per tab, default 4 |
||||
* @param bool $ltrim_nl remove a leading newline |
||||
* @param bool $ign_noindent ignore lines with zero indentation |
||||
* @return string left-trimmed block. |
||||
*/ |
||||
public static function unindentBlock($txt, $tab_size = 4, $ltrim_nl = true, $ign_noindent = true) |
||||
{ |
||||
$pad = 1024; // max indent size |
||||
$tabsp = str_repeat(' ', $tab_size); |
||||
|
||||
if ($ltrim_nl) { |
||||
// also make sure first line is not blank |
||||
$txt = ltrim($txt, "\n"); |
||||
} |
||||
|
||||
$txt = preg_replace_callback('/^([ \t]*)(?=[^ \t\n]|$)/m', |
||||
function ($m) use (&$pad, $tabsp, $ign_noindent) { |
||||
static $i = 0; |
||||
|
||||
$indent = $m[1]; |
||||
|
||||
if ($indent == '' && $ign_noindent) { |
||||
// no indentation, perhaps stripped by editor? |
||||
return ''; |
||||
} |
||||
|
||||
// normalize tab to 4 spaces |
||||
$normalized = strtr($indent, ["\t" => $tabsp]); |
||||
|
||||
$len = strlen($normalized); |
||||
$pad = min($pad, $len); |
||||
|
||||
$i++; |
||||
|
||||
return $normalized; |
||||
}, |
||||
$txt |
||||
); |
||||
|
||||
return preg_replace("/^ {{$pad}}/m", '', $txt); |
||||
} |
||||
|
||||
/** |
||||
* Get a simple string representation of an array, similar to json_encode(), |
||||
* except without the obnoxious quotes and escapes. |
||||
* |
||||
* @param array $array |
||||
* @return string [a, b, c] |
||||
*/ |
||||
public static function arr($array) |
||||
{ |
||||
if ($array instanceof Collection || Utils::isAssoc($array)) { |
||||
$x = '['; |
||||
foreach ($array as $k => $v) { |
||||
$x .= "$k:" . json_encode($v) . ', '; |
||||
} |
||||
$x = rtrim($x, ', ') . ']'; |
||||
return $x; |
||||
} else { |
||||
return '[' . implode(', ', collect($array)->map(function ($x) { |
||||
return is_array($x) ? json_encode($x, JSON_UNESCAPED_UNICODE) : (string) $x; |
||||
})->toArray()) . ']'; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Get substring from last occurrence of token |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param string $token token delimiting the last chunk from left. Not included. |
||||
* @param string $haystack |
||||
* @return string part of haystack after token. |
||||
*/ |
||||
public static function fromLast($token, $haystack) |
||||
{ |
||||
$rpos = strrpos($haystack, $token); |
||||
if ($rpos === false) return $haystack; |
||||
return substr($haystack, $rpos + strlen($token)); |
||||
} |
||||
|
||||
public static function rpad($str, $len, $fill = ' ') |
||||
{ |
||||
$filln = max(0, $len - mb_strlen($str)); |
||||
return $str . str_repeat(mb_substr($fill, 0, 1), $filln); |
||||
} |
||||
|
||||
public static function lpad($str, $len, $fill = ' ') |
||||
{ |
||||
$filln = max(0, $len - mb_strlen($str)); |
||||
return str_repeat(mb_substr($fill, 0, 1), $filln) . $str; |
||||
} |
||||
|
||||
/** |
||||
* Remove wrapping quotes from a string. |
||||
* C-slashes will also be removed. |
||||
* |
||||
* @param $str |
||||
* @return string |
||||
*/ |
||||
public static function unquote($str) |
||||
{ |
||||
if (!$str || !is_string($str)) { |
||||
return $str; |
||||
} |
||||
|
||||
$a = $str[0]; |
||||
$b = $str[strlen($str) - 1]; |
||||
if ($a == $b && $a == '"' || $b == "'") { |
||||
$str = substr($str, 1, strlen($str) - 2); |
||||
} |
||||
|
||||
$str = stripcslashes($str); |
||||
return $str; |
||||
} |
||||
|
||||
/** |
||||
* Apply a rewrite. |
||||
* |
||||
* - Simple foo|bar rewrites 0|1 (or false|true) |
||||
* - Key-value rewrite is possible with 7=foo|9=bar |
||||
* - '*' (asterisk) matches everything (9=foo|*=other) |
||||
* - '\*' - match literal asterisk |
||||
* - starts with % - format using sprintf |
||||
* - Compare funcs can also be used: lt, gt, le, ge, range, in |
||||
* example: lt(100)=Foo|range(100,200)=Bar|gt(200)=Baz |
||||
* |
||||
* @param mixed $value value from expression |
||||
* @param string $rewrite rewrite patterns, | separated |
||||
* @return mixed result to show |
||||
*/ |
||||
public static function rewrite($value, $rewrite) |
||||
{ |
||||
// TODO předělat na jednodušší zápis |
||||
if ($rewrite[0] == '%') return sprintf($rewrite, $value); |
||||
|
||||
$rewrite_map = []; |
||||
foreach (explode('|', trim($rewrite)) as $i => $rw) { |
||||
$ar = preg_split('/(?<![\\\\])=/', $rw); |
||||
|
||||
if (count($ar) == 2) { |
||||
// key value pair |
||||
$key = trim(str_replace('\=', '=', $ar[0])); |
||||
$rewrite_map[$key] = trim(str_replace('\=', '=', $ar[1])); |
||||
} elseif (count($ar) == 1) { |
||||
// literal rewrite |
||||
$rewrite_map[$i] = $rw; |
||||
} else { |
||||
Log::warning("Invalid rewrite format: $rw"); |
||||
return $value; // don't rewrite it |
||||
} |
||||
} |
||||
|
||||
// apply the rewrite if any |
||||
foreach ($rewrite_map as $k => $replacement) { |
||||
if (is_numeric($k) && (((int)$k == (int)$value) || abs((float)$k - (float)$value)<0.00001)) { |
||||
// exact match |
||||
return $replacement; |
||||
} |
||||
else if (($k==='true'||$k==='false') && (Utils::parseBool($k) == Utils::parseBool($value))) { |
||||
// bool match |
||||
return $replacement; |
||||
} |
||||
else if (preg_match('/([a-z]+)\(([^)]+)\)/i', $k, $mm)) { |
||||
// we have a comparing function |
||||
if (static::testCompareFunc($value, $mm[1], $mm[2])) { |
||||
return $replacement; |
||||
} |
||||
} |
||||
else if ($k === '*') { |
||||
return $replacement; // catch-all |
||||
} |
||||
else if ($k === '\\*') { |
||||
if ($value === '*') { |
||||
return $replacement; // literal asterisk |
||||
} |
||||
} |
||||
} |
||||
|
||||
return $value; |
||||
} |
||||
|
||||
/** |
||||
* Check if compare function matches value, copied from FB2 |
||||
* |
||||
* @param mixed $value value to format |
||||
* @param string $func function name |
||||
* @param mixed $argument extra argument for the func |
||||
* @return bool |
||||
*/ |
||||
private static function testCompareFunc($value, $func, $argument) |
||||
{ |
||||
$value_f = floatval($value); |
||||
$arg_f = floatval($argument); |
||||
|
||||
$fun = trim(strtolower($func)); |
||||
switch ($fun) { |
||||
case 'lt': |
||||
return $value_f < $arg_f; |
||||
case 'gt': |
||||
return $value_f > $arg_f; |
||||
case 'le': |
||||
return $value_f <= $arg_f; |
||||
case 'ge': |
||||
return $value_f >= $arg_f; |
||||
case 'eq': |
||||
return $value_f == $arg_f; // this is kinda useless, but to make the set complete |
||||
|
||||
case 'range': // range(-10,0) = zima |
||||
$bounds = array_map(function ($x) { |
||||
return floatval(trim($x)); |
||||
}, explode(',', $argument)); |
||||
|
||||
if (count($bounds) != 2) { |
||||
Log::error("Invalid range bounds: $argument"); |
||||
return false; |
||||
} |
||||
|
||||
return $value_f >= $bounds[0] && $value_f < $bounds[1]; |
||||
|
||||
case 'in': // in(10,20,30) = 10, 20 or 30 *funguje i pro string in(ZAP,VYP) = ZAP nebo VYP |
||||
$bounds = array_map('trim', explode(',', $argument)); |
||||
return in_array(trim($value), $bounds); |
||||
|
||||
default: |
||||
Log::error("Invalid rewrite function: $func"); |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Apply multiple sets of substitutions to a format and get all the results. |
||||
* |
||||
* @param string $format Format same as for Str::format(). Fields are marked {}, {0} or {key} |
||||
* @param array $subs_arrays array of arrays of substitutions - eg. [[a1, b1], [a2, b2], ...] |
||||
* @return array |
||||
*/ |
||||
public static function mapFormat($format, $subs_arrays) |
||||
{ |
||||
$gather = []; |
||||
foreach ($subs_arrays as $subs) { |
||||
if (!is_array($subs)) $subs = [$subs]; |
||||
$gather[] = Str::format($format, $subs); |
||||
} |
||||
return $gather; |
||||
} |
||||
|
||||
/** |
||||
* Find all needle positions within a haystack |
||||
* |
||||
* @param string $haystack |
||||
* @param string $needle |
||||
* @return array |
||||
*/ |
||||
public static function findPositions($haystack, $needle) |
||||
{ |
||||
$lastPos = 0; |
||||
$positions = []; |
||||
|
||||
while (($lastPos = strpos($haystack, $needle, $lastPos)) !== false) { |
||||
$positions[] = $lastPos; |
||||
$lastPos = $lastPos + strlen($needle); |
||||
} |
||||
|
||||
return $positions; |
||||
} |
||||
|
||||
/** |
||||
* Discard positions in a string that are preceded by an unescaped backslash. |
||||
* |
||||
* @param string $str |
||||
* @param int[] $positions |
||||
* @return int[] |
||||
*/ |
||||
public static function discardEscapedPositions($str, array $positions) |
||||
{ |
||||
$actualPos = []; |
||||
foreach ($positions as $pos) { |
||||
if ($pos >= 1) { |
||||
if ($str[$pos - 1] == '\\') { |
||||
if ($pos >= 2 && $str[$pos - 2] == '\\') { |
||||
// escaped backslash before - it's a valid quote |
||||
} else { |
||||
// this quote is escaped |
||||
continue; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$actualPos[] = $pos; |
||||
} |
||||
|
||||
return $actualPos; |
||||
} |
||||
|
||||
/** |
||||
* Split a string at given positions |
||||
* |
||||
* @param string $string |
||||
* @param int[] $positions |
||||
* @return string[] |
||||
*/ |
||||
public static function splitAt($string, $positions) |
||||
{ |
||||
$chunks = []; |
||||
array_push($positions, strlen($string)); |
||||
array_unshift($positions, -1); |
||||
|
||||
foreach ($positions as $i => $position) { |
||||
if ($position >= strlen($string)) break; |
||||
$chunks[] = substr($string, $position + 1, $positions[$i + 1] - $position - 1); |
||||
} |
||||
|
||||
return $chunks; |
||||
} |
||||
|
||||
/** |
||||
* Split a string to pieces by commas, ignoring commas within strings delimited by double quotes. |
||||
* A double quote can be escaped using a backslash. |
||||
* |
||||
* @param string $str |
||||
* @param string $delimiter |
||||
* @return mixed |
||||
*/ |
||||
public static function splitCommandArgs($str, $delimiter = ',') |
||||
{ |
||||
if ($str === '') return []; |
||||
|
||||
// Find unescaped quotes |
||||
$quotes = Str::findPositions($str, '"'); |
||||
$quotes = Str::discardEscapedPositions($str, $quotes); |
||||
|
||||
if (count($quotes) % 2 != 0) { |
||||
throw new FormatException("Unmatched quote in command arguments: $str"); |
||||
} |
||||
|
||||
$commas = Str::findPositions($str, $delimiter); |
||||
$commas = Utils::discardPositionsWithinPairs($commas, $quotes); |
||||
|
||||
$chunks = Str::splitAt($str, $commas); |
||||
|
||||
$arr = collect($chunks)->trim()->toArray(); |
||||
|
||||
return $arr; |
||||
} |
||||
|
||||
/** |
||||
* Get substring to first match of a token |
||||
* |
||||
* @param string $token token delimiting the parts |
||||
* @param string $haystack full string |
||||
* @return string portion of the string until the first token; or the whole string if token is not present. |
||||
*/ |
||||
public static function toFirst($token, $haystack) |
||||
{ |
||||
$lpos = strpos($haystack, $token); |
||||
if ($lpos === false) return $haystack; |
||||
return substr($haystack, 0, $lpos); |
||||
} |
||||
|
||||
/** |
||||
* Get substring from first match of a token |
||||
* |
||||
* @param string $token token delimiting the parts |
||||
* @param string $haystack full string |
||||
* @return string portion of the string until the first token; or empty string if token is not present. |
||||
*/ |
||||
public static function fromFirst($token, $haystack, $exclusive = false) |
||||
{ |
||||
$lpos = strpos($haystack, $token); |
||||
if ($lpos === false) return ''; |
||||
return substr($haystack, $lpos+($exclusive?1:0)); |
||||
} |
||||
|
||||
public static function toLast($token, $haystack) |
||||
{ |
||||
$rpos = strrpos($haystack, $token); |
||||
if ($rpos === false) return $haystack; |
||||
return self::substr($haystack, 0, $rpos); |
||||
} |
||||
|
||||
/** |
||||
* Check if translation exists |
||||
* |
||||
* @param string $descrKey tested transl key |
||||
* @return bool exists |
||||
*/ |
||||
public static function translationExists($descrKey) |
||||
{ |
||||
$tr = trans($descrKey); |
||||
return !preg_match('/^(\w+\.)+(\w+)$/', $tr); |
||||
} |
||||
|
||||
/** |
||||
* Expand array of strings using bash-style repeat patterns {a,b,c}, {from..to} |
||||
* |
||||
* ie. to produce ad1 to ad4, use ad{1..4}. Supports multiple patterns, producing all permutations. |
||||
* |
||||
* @param string|string[] $sourceStrings |
||||
* @return string[] |
||||
*/ |
||||
public static function expandBashRepeat($sourceStrings) |
||||
{ |
||||
if (is_string($sourceStrings)) $sourceStrings = [$sourceStrings]; |
||||
$outputs = []; |
||||
foreach($sourceStrings as $str) { |
||||
$i=0; |
||||
$arrays = []; |
||||
$str2 = preg_replace_callback('/\{([^{}]+)\}/', function($m) use(&$i, &$arrays) { |
||||
$seq = explode(',',$m[1]); |
||||
if(count($seq)>=2) { |
||||
$arrays[$i] = $seq; |
||||
} else { |
||||
$ab = explode('..',$m[1]); |
||||
if (!$ab) { return $m[0]; } |
||||
$a = intval($ab[0]); |
||||
$b = intval($ab[1]); |
||||
$arrays[$i] = range($a, $b); |
||||
} |
||||
|
||||
return '{{'.($i++).'}}'; |
||||
}, $str); |
||||
|
||||
$strs = [$str2]; |
||||
for($n=count($arrays)-1;$n>=0;$n--) { |
||||
$arr = $arrays[$n]; |
||||
$tmpstrs = []; |
||||
|
||||
foreach($arr as $subs) { |
||||
foreach($strs as $ss) { |
||||
$tmpstrs[] = str_replace('{{'.$n.'}}', $subs, $ss); |
||||
} |
||||
} |
||||
|
||||
$strs = $tmpstrs; |
||||
} |
||||
|
||||
$outputs = array_merge($outputs, $strs); |
||||
} |
||||
return $outputs; |
||||
} |
||||
|
||||
/** |
||||
* Remove trailing commas from JSON string |
||||
* |
||||
* @param string $str |
||||
* @return string |
||||
*/ |
||||
public static function cleanJson($str) |
||||
{ |
||||
return preg_replace('/,\s*([}\]])/s','\1', $str); |
||||
} |
||||
|
||||
public static function ellipsis($str, $maxlen) |
||||
{ |
||||
$len = mb_strlen($str); |
||||
if ($len > $maxlen) { |
||||
return mb_substr($str, 0, $maxlen) . '…'; |
||||
} |
||||
|
||||
return $str; |
||||
} |
||||
} |
@ -0,0 +1,991 @@ |
||||
<?php |
||||
|
||||
namespace MightyPork\Utils; |
||||
|
||||
use Collator; |
||||
use MightyPork\Exceptions\ArgumentException; |
||||
use Illuminate\Log\Events\MessageLogged; |
||||
use Log; |
||||
use MightyPork\Exceptions\FormatException; |
||||
use MongoDB\BSON\ObjectID; |
||||
use Monolog\Formatter\LineFormatter; |
||||
use ReflectionClass; |
||||
use ReflectionMethod; |
||||
|
||||
/** |
||||
* Miscellaneous utilities, mostly from FB2 |
||||
*/ |
||||
class Utils |
||||
{ |
||||
/** @var Collator */ |
||||
private static $collator = null; |
||||
|
||||
/** |
||||
* Clamp to an array with lower and upper bounds |
||||
* |
||||
* @param float $value |
||||
* @param float[] $arr |
||||
* @return float |
||||
*/ |
||||
public static function arrClamp($value, $arr) |
||||
{ |
||||
if (!$arr) return $value; |
||||
if ($arr[0] !== null) $value = max($arr[0], $value); |
||||
if ($arr[1] !== null) $value = min($arr[1], $value); |
||||
|
||||
return $value; |
||||
} |
||||
|
||||
/** |
||||
* Convert possible "boolean" values to 1/0 |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param mixed $value boolean, integer or string |
||||
* @return int 1 or 0 |
||||
*/ |
||||
public static function parseBool01($value) |
||||
{ |
||||
// already boolean - to 0 / 1 |
||||
if (is_bool($value)) { |
||||
return $value ? 1 : 0; |
||||
} |
||||
|
||||
// convert to string if needed (ie. SimpleXMLElement) |
||||
// small overhead for numbers (negligible) |
||||
$value = (string) $value; |
||||
|
||||
// Number or numeric string |
||||
if (is_numeric($value)) { |
||||
return ((int) $value) != 0 ? 1 : 0; |
||||
} |
||||
|
||||
// match string constants |
||||
switch (strtolower("$value")) { |
||||
case 'on': |
||||
case 'true': |
||||
case 'yes': |
||||
return 1; |
||||
|
||||
case 'off': |
||||
case 'false': |
||||
case 'no': |
||||
case 'null': |
||||
case '': // empty string |
||||
return 0; |
||||
|
||||
default: |
||||
Log::warning("Could not convert \"$value\" to boolean."); |
||||
return 0; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Convert possible "boolean" values to true/false |
||||
* |
||||
* @param mixed $value boolean, integer or string |
||||
* @return bool |
||||
*/ |
||||
public static function parseBool($value) |
||||
{ |
||||
return (bool) self::parseBool01($value); |
||||
} |
||||
|
||||
/** |
||||
* Get string representation of object type. |
||||
* |
||||
* Aliased as global helper "typeof" |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param mixed $var inspected variable |
||||
* @return string |
||||
*/ |
||||
public static function getType($var) |
||||
{ |
||||
if (is_object($var)) return get_class($var); |
||||
if (is_null($var)) return 'null'; |
||||
if (is_string($var)) return 'string'; |
||||
if (is_array($var)) return 'array'; |
||||
if (is_int($var)) return 'integer'; |
||||
if (is_bool($var)) return 'boolean'; |
||||
if (is_float($var)) return 'float'; |
||||
if (is_resource($var)) return 'resource'; |
||||
|
||||
return 'unknown'; |
||||
} |
||||
|
||||
/** |
||||
* provide a Java style exception trace |
||||
* |
||||
* @param \Throwable $e |
||||
* @return array stack trace as array of lines |
||||
* from comment at: http://php.net/manual/en/class.exception.php |
||||
*/ |
||||
public static function getStackTrace($e) |
||||
{ |
||||
return explode("\n", self::getStackTraceAsString($e)); |
||||
} |
||||
|
||||
/** |
||||
* provide a Java style exception trace |
||||
* |
||||
* @param \Throwable $e |
||||
* @param array|null $seen internal for recursion |
||||
* @return string stack trace as string with multiple lines |
||||
*/ |
||||
public static function getStackTraceAsString($e, $seen = null) |
||||
{ |
||||
if (!config('fb.pretty_stack_trace')) { |
||||
return $e->getTraceAsString(); |
||||
} |
||||
|
||||
$starter = $seen ? 'Caused by: ' : ''; |
||||
$result = []; |
||||
if (!$seen) $seen = []; |
||||
$trace = $e->getTrace(); |
||||
$prev = $e->getPrevious(); |
||||
$result[] = sprintf('%s%s: %s', $starter, get_class($e), $e->getMessage()); |
||||
$file = $e->getFile(); |
||||
$line = $e->getLine(); |
||||
while (true) { |
||||
$current = "$file:$line"; |
||||
if (is_array($seen) && in_array($current, $seen)) { |
||||
$result[] = sprintf(" ... %d more", count($trace) + 1); |
||||
break; |
||||
} |
||||
$resline = sprintf(" at %s%s%s(%s%s%s)", |
||||
count($trace) && array_key_exists('class', $trace[0]) ? $trace[0]['class'] : '', |
||||
count($trace) && array_key_exists('class', $trace[0]) && array_key_exists('function', $trace[0]) ? '->' : '', |
||||
count($trace) && array_key_exists('function', $trace[0]) ? $trace[0]['function'] : '(main)', |
||||
$line === null ? $file : basename($file), |
||||
$line === null ? '' : ':', |
||||
$line === null ? '' : $line); |
||||
|
||||
$result[] = $resline; |
||||
|
||||
if ( |
||||
false !== strpos($resline, "Illuminate\\Console\\Command->execute") || |
||||
false !== strpos($resline, "Illuminate\\Routing\\ControllerDispatcher->dispatch") || |
||||
false !== strpos($resline, "Unknown Source") || |
||||
false !== strpos($resline, "eval(SandboxController.php") |
||||
) { |
||||
$result[] = sprintf(" ... %d more", count($trace) + 1); |
||||
break; |
||||
} |
||||
|
||||
if (is_array($seen)) { |
||||
$seen[] = "$file:$line"; |
||||
} |
||||
|
||||
if (!count($trace)) break; |
||||
|
||||
$file = array_key_exists('file', $trace[0]) ? $trace[0]['file'] : 'Unknown Source'; |
||||
$line = array_key_exists('file', $trace[0]) && array_key_exists('line', $trace[0]) && $trace[0]['line'] ? $trace[0]['line'] : null; |
||||
array_shift($trace); |
||||
} |
||||
|
||||
$result = join("\n", $result); |
||||
if ($prev) { |
||||
$result .= "\n" . self::getStackTraceAsString($prev, $seen); |
||||
} |
||||
|
||||
return $result; |
||||
} |
||||
|
||||
/** |
||||
* Diff arrays of objects by one of their properties. |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param array $array1 |
||||
* @param array $array2 |
||||
* @param string $prop property name (accessed using the arrow operator) |
||||
* @return array of (first - second) array. |
||||
*/ |
||||
public static function arrayDiffProp($array1, $array2, $prop) |
||||
{ |
||||
return array_udiff($array1, $array2, function ($a, $b) use ($prop) { |
||||
return $a->$prop - $b->$prop; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Sort array by field of each item |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param array $array the array to sort |
||||
* @param string|string[] $prop property or properties |
||||
*/ |
||||
public static function arraySortProp(&$array, $prop) |
||||
{ |
||||
if (!is_array($prop)) $prop = [$prop]; |
||||
|
||||
@usort($array, function ($a, $b) use ($prop) { |
||||
|
||||
// compare by each property |
||||
foreach ($prop as $pr) { |
||||
$cmp = strcasecmp($a->$pr, $b->$pr); |
||||
if ($cmp != 0) return $cmp; |
||||
} |
||||
|
||||
return 0; |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Group an array using a callback or each element's property/index |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param array $arr array to group |
||||
* @param callable|string $grouper hashing function, or property/index of each item to group by |
||||
* @return array grouped |
||||
*/ |
||||
public static function groupBy(array $arr, $grouper) |
||||
{ |
||||
$first_el = reset($arr); |
||||
$is_array = is_array($first_el) || ($first_el instanceof \ArrayAccess); |
||||
|
||||
// get real grouper func |
||||
$func = is_callable($grouper) ? $grouper : function ($x) use ($is_array, $grouper) { |
||||
if ($is_array) { |
||||
return $x[$grouper]; |
||||
} else { |
||||
return $x->$grouper; |
||||
} |
||||
}; |
||||
|
||||
$grouped = []; |
||||
|
||||
foreach ($arr as $item) { |
||||
$hash = $func($item); |
||||
if (!isset($grouped[$hash])) { |
||||
$grouped[$hash] = []; |
||||
} |
||||
|
||||
$grouped[$hash][] = $item; |
||||
} |
||||
|
||||
return $grouped; |
||||
} |
||||
|
||||
/** |
||||
* Get union of two arrays, preserving order if possible. |
||||
* |
||||
* @param array $ar1 |
||||
* @param array $ar2 |
||||
* @return array merged |
||||
*/ |
||||
public static function arrayUnion(array $ar1, array $ar2) |
||||
{ |
||||
return array_unique(array_merge($ar1, $ar2)); |
||||
} |
||||
|
||||
/** |
||||
* Create an array with keys from given array and all the same values. |
||||
* |
||||
* It's array_combine() combined with array_fill() |
||||
* |
||||
* @param array $keys |
||||
* @param mixed $fill the value for all keys |
||||
* @return array |
||||
*/ |
||||
public static function arrayKeysFill(array $keys, $fill) |
||||
{ |
||||
return array_combine($keys, array_fill(0, count($keys), $fill)); |
||||
} |
||||
|
||||
/** |
||||
* Extract n-th bit from an int array. |
||||
* |
||||
* Bits are numbered from LSB to MSB, and from array index 0 upwards |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param array $ints array of ints |
||||
* @param int $bit index of a bit to retrieve |
||||
* @param int $itemSize number of bits per array item, default 16 |
||||
* @return int the bit, 0/1 |
||||
*/ |
||||
public static function bitFromIntArray(array $ints, $bit, $itemSize = 16) |
||||
{ |
||||
$nth = (int) floor($bit / $itemSize); |
||||
$bit_n = $bit - ($itemSize * $nth); |
||||
|
||||
if ($nth > count($ints)) return 0; |
||||
|
||||
return (int) (0 != ($ints[$nth] & (1 << $bit_n))); |
||||
} |
||||
|
||||
/** |
||||
* Set socket timeout in MS |
||||
* |
||||
* @param resource $socket socket |
||||
* @param int $SO_xxTIMEO timeout type constant |
||||
* @param int $timeout_ms timeout (millis) |
||||
*/ |
||||
public static function setSocketTimeout(&$socket, $SO_xxTIMEO, $timeout_ms) |
||||
{ |
||||
$to_sec = floor($timeout_ms / 1000); |
||||
$to_usec = ($timeout_ms - $to_sec * 1000) * 1000; |
||||
$timeout = ['sec' => $to_sec, 'usec' => $to_usec]; |
||||
socket_set_option($socket, SOL_SOCKET, $SO_xxTIMEO, $timeout); |
||||
} |
||||
|
||||
/** |
||||
* Check if value is in given range |
||||
* |
||||
* @param int|float $value value |
||||
* @param int|float $low lower bound - included |
||||
* @param int|float $high upper bound - included |
||||
* @return bool is in range |
||||
*/ |
||||
public static function inRange($value, $low, $high) |
||||
{ |
||||
// swap bounds if reverse |
||||
if ($low > $high) { |
||||
$sw = $low; |
||||
$low = $high; |
||||
$high = $sw; |
||||
} |
||||
|
||||
return $value >= $low && $value <= $high; |
||||
} |
||||
|
||||
/** |
||||
* Reverse the effect of array_chunk. |
||||
* |
||||
* @param array $array |
||||
* @return array |
||||
*/ |
||||
public static function array_unchunk($array) |
||||
{ |
||||
return call_user_func_array('array_merge', $array); |
||||
} |
||||
|
||||
/** |
||||
* Clamp value to given bounds |
||||
* |
||||
* @param float $value input |
||||
* @param float $min lower bound - included |
||||
* @param float $max upper bound - included |
||||
* @return float result |
||||
*/ |
||||
public static function clamp($value, $min, $max) |
||||
{ |
||||
// swap bounds if reverse |
||||
if ($min > $max) { |
||||
$sw = $min; |
||||
$min = $max; |
||||
$max = $sw; |
||||
} |
||||
|
||||
if ($value < $min) { |
||||
$value = $min; |
||||
} else if ($value > $max) { |
||||
$value = $max; |
||||
} |
||||
return $value; |
||||
} |
||||
|
||||
/** |
||||
* Get today as the nr of days since epoch |
||||
* |
||||
* @return int nr of days |
||||
*/ |
||||
public static function unixDay() |
||||
{ |
||||
$dt = new \DateTime('@' . ntime()); |
||||
$epoch = new \DateTime('1970-01-01'); |
||||
$diff = $dt->diff($epoch); |
||||
return (int) $diff->format("%a"); |
||||
} |
||||
|
||||
/** |
||||
* Check if the value looks like a Mongo key (ObjectID). |
||||
* Mongo key is a 24 chars long hex string, so it's unlikely to occur as an alias. |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param mixed $key object to inspect (string or ObjectID) |
||||
* @return bool is _id value |
||||
*/ |
||||
public static function isMongoKey($key) |
||||
{ |
||||
if ($key instanceof ObjectID) return true; |
||||
|
||||
return (is_string($key) and strlen($key) === 24 and ctype_xdigit($key)); |
||||
} |
||||
|
||||
/** |
||||
* Check if array is associative |
||||
* |
||||
* TODO unit test |
||||
* |
||||
* @param array $array |
||||
* @return bool is associative (keys are not a sequence of numbers starting 0) |
||||
*/ |
||||
public static function isAssoc(array $array) |
||||
{ |
||||
return array_keys($array) !== range(0, count($array) - 1); |
||||
} |
||||
|
||||
/** |
||||
* Ceil to closest multiple of 0.5 |
||||
* |
||||
* @param float $n |
||||
* @return float rounded up to 0.5 |
||||
*/ |
||||
public static function halfCeil($n) |
||||
{ |
||||
return ceil($n * 2) / 2; |
||||
} |
||||
|
||||
/** |
||||
* Round to closest multiple of 0.5 |
||||
* |
||||
* @param float $n |
||||
* @return float rounded to 0.5 |
||||
*/ |
||||
public static function halfRound($n) |
||||
{ |
||||
return round($n * 2) / 2; |
||||
} |
||||
|
||||
/** |
||||
* Floor to closest multiple of 0.5 |
||||
* |
||||
* @param float $n |
||||
* @return float rounded down to 0.5 |
||||
*/ |
||||
public static function halfFloor($n) |
||||
{ |
||||
return ceil($n * 2) / 2; |
||||
} |
||||
|
||||
/** |
||||
* A dirty way to read private or protected fields. |
||||
* Use only for debugging or vendor hacking when really needed. |
||||
* |
||||
* @param mixed $obj |
||||
* @param string $prop |
||||
* @return mixed |
||||
*/ |
||||
public static function readProtected($obj, $prop) |
||||
{ |
||||
$reflection = new ReflectionClass($obj); |
||||
$property = $reflection->getProperty($prop); |
||||
$property->setAccessible(true); |
||||
return $property->getValue($obj); |
||||
} |
||||
|
||||
/** |
||||
* A dirty way to write private or protected fields. |
||||
* Use only for debugging or vendor hacking when really needed. |
||||
* |
||||
* @param mixed $obj |
||||
* @param string $prop |
||||
* @param mixed $value |
||||
*/ |
||||
public static function writeProtected($obj, $prop, $value) |
||||
{ |
||||
$reflection = new ReflectionClass($obj); |
||||
$property = $reflection->getProperty($prop); |
||||
$property->setAccessible(true); |
||||
$property->setValue($obj, $value); |
||||
} |
||||
|
||||
/** |
||||
* A dirty way to call private or protected methods. |
||||
* Use only for debugging or vendor hacking when really needed. |
||||
* |
||||
* @param mixed $obj |
||||
* @param string $methodName |
||||
* @param array ...$arguments |
||||
* @return mixed |
||||
*/ |
||||
public static function callProtected($obj, $methodName, ...$arguments) |
||||
{ |
||||
$method = new ReflectionMethod(get_class($obj), $methodName); |
||||
$method->setAccessible(true); |
||||
return $method->invoke($obj, ...$arguments); |
||||
} |
||||
|
||||
/** |
||||
* Get class constants |
||||
* |
||||
* @param string $class f. q. class name |
||||
* @return array constants |
||||
*/ |
||||
public static function getClassConstants($class) |
||||
{ |
||||
$reflect = new ReflectionClass($class); |
||||
return $reflect->getConstants(); |
||||
} |
||||
|
||||
/** |
||||
* Start printing log messages to stdout (for debug) |
||||
*/ |
||||
public static function logToStdout($htmlEscape = true) |
||||
{ |
||||
$lf = new LineFormatter(); |
||||
Log::listen(function ($obj) use ($htmlEscape, $lf) { |
||||
/** @var MessageLogged $obj */ |
||||
|
||||
$message = $obj->message; |
||||
$context = $obj->context; |
||||
$level = $obj->level; |
||||
|
||||
if ($message instanceof \Exception) { |
||||
$message = self::getStackTraceAsString($message); |
||||
} |
||||
|
||||
if ($htmlEscape) $message = e($message); |
||||
|
||||
$time = microtime(true) - APP_START_TIME; |
||||
echo sprintf("%7.3f", $time) . " [$level] $message"; |
||||
if (!empty($context)) echo Utils::callProtected($lf, 'stringify', $context); |
||||
echo "\n"; |
||||
}); |
||||
} |
||||
|
||||
public static function logQueries() |
||||
{ |
||||
\DB::listen(function ($query) { |
||||
Log::debug("--- Query ---"); |
||||
Log::debug('SQL: ' . $query->sql); |
||||
Log::debug('Bindings: ' . json_encode($query->bindings, 128)); |
||||
Log::debug("-------------"); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Given an array of comma and quote positions, returns all commas that aren't within a pair of quotes. |
||||
* |
||||
* @param int[] $commas |
||||
* @param int[] $quotes |
||||
* @return int[] |
||||
*/ |
||||
public static function discardPositionsWithinPairs($commas, $quotes) |
||||
{ |
||||
$pairs = array_chunk($quotes, 2); |
||||
|
||||
$goodCommas = []; |
||||
foreach ($commas as $comma) { |
||||
$found = false; |
||||
foreach ($pairs as $pair) { |
||||
if ($comma > $pair[0] && $comma < $pair[1]) { |
||||
$found = true; |
||||
break; |
||||
} |
||||
} |
||||
if (!$found) { |
||||
$goodCommas[] = $comma; |
||||
} |
||||
} |
||||
|
||||
return $goodCommas; |
||||
} |
||||
|
||||
/** |
||||
* Check if any item in an array is true. |
||||
* |
||||
* @param bool[] $arr |
||||
* @return bool |
||||
*/ |
||||
public static function anyTrue($arr) |
||||
{ |
||||
foreach ($arr as $item) { |
||||
if ($item) return true; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* Get all keys from an array whose values match a given set. |
||||
* |
||||
* @param array $arr |
||||
* @param array|mixed $allowed_values |
||||
* @return array |
||||
*/ |
||||
public static function keysOfValues($arr, $allowed_values) |
||||
{ |
||||
if (!is_array($allowed_values)) { |
||||
$allowed_values = [$allowed_values]; |
||||
} |
||||
|
||||
$matched = []; |
||||
foreach ($arr as $k => $v) { |
||||
if (in_array($v, $allowed_values)) { |
||||
$matched[] = $k; |
||||
} |
||||
} |
||||
|
||||
return $matched; |
||||
} |
||||
|
||||
/** |
||||
* Convert value within range to a ratio of this range. |
||||
* eg. 5 on 0..10 = 0.5 |
||||
* |
||||
* @param float $value |
||||
* @param float $minValue |
||||
* @param float $maxValue |
||||
* @return float |
||||
*/ |
||||
public static function valToRatio($value, $minValue, $maxValue) |
||||
{ |
||||
$value = Utils::clamp($value, $minValue, $maxValue); |
||||
return ($value - $minValue) / ($maxValue - $minValue); |
||||
} |
||||
|
||||
/** |
||||
* Apply ratio to a range & get proportional value. |
||||
* eg. 0.5 on 0..10 = 5 |
||||
* |
||||
* @param $ratio |
||||
* @param $minValue |
||||
* @param $maxValue |
||||
* @return mixed |
||||
*/ |
||||
public static function ratioToVal($ratio, $minValue, $maxValue) |
||||
{ |
||||
$ratio = Utils::clamp($ratio, 0, 1); |
||||
return $minValue + ($maxValue - $minValue) * $ratio; |
||||
} |
||||
|
||||
/** |
||||
* Range transformation |
||||
* |
||||
* @param float $value |
||||
* @param float $minInput |
||||
* @param float $maxInput |
||||
* @param float $minOutput |
||||
* @param float $maxOutput |
||||
* @return float |
||||
*/ |
||||
public static function transform($value, $minInput, $maxInput, $minOutput, $maxOutput) |
||||
{ |
||||
$ratio = self::valToRatio($value, $minInput, $maxInput); |
||||
return self::ratioToVal($ratio, $minOutput, $maxOutput); |
||||
} |
||||
|
||||
private static function initSortCollator() |
||||
{ |
||||
if (self::$collator === null) { |
||||
if (extension_loaded('intl')) { |
||||
if (is_object($collator = collator_create('cs_CZ.UTF-8'))) { |
||||
$collator->setAttribute(Collator::NUMERIC_COLLATION, Collator::ON); |
||||
self::$collator = $collator; |
||||
} |
||||
} else { |
||||
Log::warning('!! Intl PHP extension not installed / enabled.'); |
||||
self::$collator = false; |
||||
} |
||||
} |
||||
} |
||||
|
||||
public static function mbNatCaseCompare($a, $b) |
||||
{ |
||||
self::initSortCollator(); |
||||
|
||||
$a = "$a"; |
||||
$b = "$b"; |
||||
|
||||
if (strlen($a) > 0 && $a[0] == '_') if (strlen($b) == 0 || $b[0] != '_') return 1; |
||||
if (strlen($b) > 0 && $b[0] == '_') if (strlen($a) == 0 || $a[0] != '_') return -1; |
||||
|
||||
if ($a === "" && $b !== "") return 1; |
||||
if ($a !== "" && $b === "") return -1; |
||||
if ($a === "" && $b === "") return 0; |
||||
|
||||
if (self::$collator) |
||||
return self::$collator->compare($a, $b); |
||||
else |
||||
return strnatcasecmp($a, $b); |
||||
} |
||||
|
||||
public static function mbNatCaseSort(&$arr) |
||||
{ |
||||
uasort($arr, function ($a, $b) { |
||||
return self::mbNatCaseCompare($a, $b); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Check if exception should be reported in eventlog. |
||||
* |
||||
* @param \Exception $e |
||||
* @return bool |
||||
*/ |
||||
public static function shouldReportException(\Exception $e) |
||||
{ |
||||
$eh = app(\Illuminate\Contracts\Debug\ExceptionHandler::class); |
||||
return Utils::callProtected($eh, 'shouldReport', $e); |
||||
} |
||||
|
||||
const GEO_DEG = 'GEO_DEGREES'; |
||||
const GEO_DEG_MIN = 'GEO_DEG_MIN'; |
||||
const GEO_DEG_MIN_SEC = 'GEO_DEG_MIN_SEC'; |
||||
|
||||
/** |
||||
* @param string|int $coord |
||||
* @return float |
||||
*/ |
||||
public static function geoToDegrees($coord) |
||||
{ |
||||
$coord = "$coord"; |
||||
|
||||
// remove any whitespace |
||||
$coord = preg_replace('/\s/', '', $coord); |
||||
if (strlen($coord) == 0) throw new ArgumentException("\"$coord\" is not in a known GPS coordinate format"); |
||||
|
||||
// remove leading letter, invert if needed |
||||
$invert = false; |
||||
if (in_array($coord[0], ['N', 'S', 'E', 'W'])) { |
||||
$invert = in_array($coord[0], ['S', 'W']); |
||||
$coord = substr($coord, 1); |
||||
} |
||||
if (in_array($coord[strlen($coord) - 1], ['N', 'S', 'E', 'W'])) { |
||||
$invert = in_array($coord[strlen($coord) - 1], ['S', 'W']); |
||||
$coord = substr($coord, 0, -1); |
||||
} |
||||
|
||||
$invert = $invert ? -1 : 1; |
||||
|
||||
// Degrees |
||||
if (Str::maskMatch("F°?", $coord)) { |
||||
return $invert * floatval(rtrim($coord, '°')); |
||||
} |
||||
|
||||
if (Str::maskMatch("D°F'?", $coord)) { |
||||
list($d, $m) = explode('°', $coord); |
||||
$d = floatval($d); |
||||
if ($d < 0) { |
||||
$d = -$d; |
||||
$invert *= -1; |
||||
} |
||||
$m = floatval(rtrim($m, "'")); |
||||
return $invert * ($d + $m / 60); |
||||
} |
||||
|
||||
if (Str::maskMatch("D°D'F\"?", $coord)) { |
||||
list($d, $ms) = explode('°', $coord); |
||||
list($m, $s) = explode("'", $ms); |
||||
|
||||
$d = floatval($d); |
||||
if ($d < 0) { |
||||
$d = -$d; |
||||
$invert *= -1; |
||||
} |
||||
$m = floatval($m); |
||||
$s = floatval(rtrim($s, '"')); |
||||
return $invert * ($d + ($m + $s / 60) / 60); |
||||
} |
||||
|
||||
throw new ArgumentException("\"$coord\" is not in a known GPS coordinate format"); |
||||
} |
||||
|
||||
public static function convertGeoNS($coord, $target = self::GEO_DEG) |
||||
{ |
||||
$result = self::convertGeo($coord, $target); |
||||
if ($result[0] == '-') { |
||||
$result = 'S ' . substr($result, 1); |
||||
} else { |
||||
$result = 'N ' . $result; |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
public static function convertGeoEW($coord, $target = self::GEO_DEG) |
||||
{ |
||||
$result = self::convertGeo($coord, $target); |
||||
if ($result[0] == '-') { |
||||
$result = 'W ' . substr($result, 1); |
||||
} else { |
||||
$result = 'E ' . $result; |
||||
} |
||||
return $result; |
||||
} |
||||
|
||||
public static function convertGeo($coord, $target = self::GEO_DEG) |
||||
{ |
||||
$degrees = self::geoToDegrees($coord); |
||||
$invert = $degrees < 0; |
||||
$degrees = abs($degrees); |
||||
|
||||
$invert = $invert ? -1 : 1; |
||||
|
||||
switch ($target) { |
||||
case self::GEO_DEG: |
||||
return "" . $invert * round($degrees, 5); |
||||
|
||||
case self::GEO_DEG_MIN: |
||||
$frac = $degrees - floor($degrees); |
||||
$mins = $frac * 60; |
||||
return ($invert * floor($degrees)) . "° " . round($mins, 3) . "'"; |
||||
|
||||
case self::GEO_DEG_MIN_SEC: |
||||
$frac = $degrees - floor($degrees); |
||||
$mins = $frac * 60; |
||||
$frac = $mins - floor($mins); |
||||
$secs = $frac * 60; |
||||
return ($invert * floor($degrees)) . "° " . floor($mins) . "' " . round($secs, 1) . "\""; |
||||
|
||||
default: |
||||
throw new ArgumentException("$target is not a valid geo coord format"); |
||||
} |
||||
} |
||||
|
||||
public static function formatFileSize($bytes) |
||||
{ |
||||
if ($bytes >= 1073741824) |
||||
{ |
||||
$bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
||||
} |
||||
elseif ($bytes >= 1048576) |
||||
{ |
||||
$bytes = number_format($bytes / 1048576, 2) . ' MB'; |
||||
} |
||||
elseif ($bytes >= 1024) |
||||
{ |
||||
$bytes = number_format($bytes / 1024, 2) . ' kB'; |
||||
} |
||||
else |
||||
{ |
||||
$bytes = $bytes . ' B'; |
||||
} |
||||
|
||||
return $bytes; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Format date safely for y2038 |
||||
* |
||||
* @param string $format date format string |
||||
* @param int|null $timestamp formatted timestamp, or null for current time |
||||
* @return string result |
||||
*/ |
||||
public static function fdate($format, $timestamp = null) |
||||
{ |
||||
if ($timestamp === null) $timestamp = time(); |
||||
|
||||
$dt = new \DateTime('@' . $timestamp); // UTC |
||||
$dt->setTimezone(new \DateTimeZone(date('e'))); // set local timezone |
||||
return $dt->format($format); |
||||
} |
||||
|
||||
/** |
||||
* Format time as XXd XXh XXm XXs (parse-able by HumanTime) |
||||
* |
||||
* @param int $secs seconds |
||||
* @param bool $rough get only approximate time (for estimate) |
||||
* @return string result |
||||
*/ |
||||
public static function ftime($secs, $rough = false) |
||||
{ |
||||
$d = (int) ($secs / 86400); |
||||
$secs -= $d * 86400; |
||||
$h = (int) ($secs / 3600); |
||||
$secs -= $h * 3600; |
||||
$m = (int) ($secs / 60); |
||||
$secs -= $m * 60; |
||||
$s = $secs; |
||||
|
||||
$chunks = []; |
||||
|
||||
if ($rough) { |
||||
if ($d > 5) { |
||||
if ($h > 15) $d++; // round up |
||||
$chunks[] = "{$d}d"; |
||||
} elseif ($d >= 1) { |
||||
$chunks[] = "{$d}d"; |
||||
|
||||
if ($h) $chunks[] = "{$h}h"; |
||||
} else { |
||||
// under 1 d |
||||
if ($h >= 4) { |
||||
if ($m > 40) $h++; // round up |
||||
$chunks[] = "{$h}h"; |
||||
} elseif ($h >= 1) { |
||||
$chunks[] = "{$h}h"; |
||||
|
||||
if ($m) $chunks[] = "{$m}m"; |
||||
} else { |
||||
if ($m) $chunks[] = "{$m}m"; |
||||
|
||||
if ($s || empty($chunks)) { |
||||
$chunks[] = "{$s}s"; |
||||
} |
||||
} |
||||
} |
||||
} else { |
||||
// precise |
||||
|
||||
if ($d) $chunks[] = "{$d}d"; |
||||
if ($h) $chunks[] = "{$h}h"; |
||||
if ($m) $chunks[] = "{$m}m"; |
||||
|
||||
if ($s || empty($chunks)) { |
||||
$chunks[] = "{$s}s"; |
||||
} |
||||
} |
||||
|
||||
return trim(implode(' ', $chunks)); |
||||
} |
||||
/** |
||||
* Get time in seconds from user entered interval |
||||
* |
||||
* @param $time |
||||
* @return int seconds |
||||
*/ |
||||
public static function strToSeconds($time) |
||||
{ |
||||
// seconds pass through |
||||
if (preg_match('/^\d+$/', trim("$time"))) { |
||||
return intval($time); |
||||
} |
||||
|
||||
$time = preg_replace('/(\s*|,|and)/i', '', $time); |
||||
$pieces = preg_split('/(?<=[a-z])(?=\d)/i', $time, 0, PREG_SPLIT_NO_EMPTY); |
||||
return array_sum(array_map('self::strToSeconds_do', $pieces)); |
||||
} |
||||
|
||||
/** @noinspection PhpUnusedPrivateMethodInspection */ |
||||
private static function strToSeconds_do($time) |
||||
{ |
||||
if (preg_match('/^(\d+)\s*(s|secs?|seconds?)$/', $time, $m)) { |
||||
return intval($m[1]); |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(m|mins?|minutes?)$/', $time, $m)) { |
||||
return intval($m[1]) * 60; |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(h|hours?)$/', $time, $m)) { |
||||
return intval($m[1]) * 60*60; |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(d|days?)$/', $time, $m)) { |
||||
return intval($m[1]) * 86400; |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(w|weeks?)$/', $time, $m)) { |
||||
return intval($m[1]) * 86400*7; |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(M|months?)$/', $time, $m)) { |
||||
return intval($m[1]) * 86400*30; |
||||
} |
||||
|
||||
if (preg_match('/^(\d+)\s*(y|years?)$/', $time, $m)) { |
||||
return intval($m[1]) * 86400*365; |
||||
} |
||||
|
||||
throw new FormatException("Bad time interval: \"$time\""); |
||||
} |
||||
} |
@ -0,0 +1,317 @@ |
||||
<?php |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Global helper functions |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Functions defined here are available anywhere in the application. |
||||
| |
||||
*/ |
||||
|
||||
use MightyPork\Utils\ObjCollection; |
||||
use MightyPork\Utils\Profiler; |
||||
use MightyPork\Utils\Str; |
||||
use MightyPork\Utils\Utils; |
||||
|
||||
#region Defines |
||||
|
||||
define('IDENTIFIER_PATTERN', '/^[a-z][a-z0-9_]*$/i'); |
||||
define('USERNAME_PATTERN', '/^[a-z0-9_-]+$/i'); |
||||
|
||||
#endregion |
||||
|
||||
#region View helpers |
||||
|
||||
/** to bool 01 */ |
||||
function bool01($x) |
||||
{ |
||||
return Utils::parseBool01($x); |
||||
} |
||||
|
||||
/** |
||||
* Conditional helper for view (same as: A ? B : '') |
||||
* |
||||
* @param bool $cond Condition to check |
||||
* @param string $then Value to use if condition is true, otherwise empty string. |
||||
* @param string $else False value |
||||
* @return string result for the view. |
||||
*/ |
||||
function when($cond, $then, $else = '') |
||||
{ |
||||
return $cond ? $then : $else; |
||||
} |
||||
|
||||
/** |
||||
* Conditional helper for view, opposite of when() |
||||
* |
||||
* @param bool $cond Condition to check |
||||
* @param string $then Value to use if condition is false, otherwise empty string. |
||||
* @param string $else True value |
||||
* @return string result for the view. |
||||
*/ |
||||
function unless($cond, $then, $else = '') |
||||
{ |
||||
return $cond ? $else : $then; |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region General purpose helpers |
||||
|
||||
|
||||
/** |
||||
* Wrapper for nested arrays or objects. |
||||
* - Undefined keys are returned as null. |
||||
* - array and object values are wrapped in objBag when returned. |
||||
*/ |
||||
class objBag implements JsonSerializable { |
||||
private $wrapped; |
||||
|
||||
public function __construct($wrapped) |
||||
{ |
||||
$this->wrapped = (object)$wrapped; |
||||
} |
||||
|
||||
public function __get($name) |
||||
{ |
||||
if ($this->wrapped) { |
||||
if (isset($this->wrapped->$name)) { |
||||
$x = $this->wrapped->$name; |
||||
if (is_array($x) || is_object($x)) return objBag($x); |
||||
return $x; |
||||
} |
||||
} |
||||
|
||||
return null; |
||||
} |
||||
|
||||
public function __isset($name) |
||||
{ |
||||
return isset($this->wrapped->$name); |
||||
} |
||||
|
||||
public function get($name, $def = null) |
||||
{ |
||||
if (!isset($this->$name)) return $def; |
||||
return $this->$name; |
||||
} |
||||
|
||||
public function has($name) |
||||
{ |
||||
return isset($this->$name); |
||||
} |
||||
|
||||
public function unpack() |
||||
{ |
||||
return $this->wrapped; |
||||
} |
||||
|
||||
/** |
||||
* Specify data which should be serialized to JSON |
||||
* |
||||
* @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||||
* @return mixed data which can be serialized by <b>json_encode</b>, |
||||
* which is a value of any type other than a resource. |
||||
* @since 5.4.0 |
||||
*/ |
||||
public function jsonSerialize() |
||||
{ |
||||
return $this->wrapped; |
||||
} |
||||
} |
||||
|
||||
function objBag($obj) { |
||||
return new \objBag($obj); |
||||
} |
||||
|
||||
/** |
||||
* Helper to check if model exists. |
||||
* |
||||
* Related to https://github.com/laravel/framework/issues/13988 |
||||
* |
||||
* @param \Illuminate\Database\Eloquent\Model|null $model |
||||
* @return bool |
||||
*/ |
||||
function model_exists(Illuminate\Database\Eloquent\Model $model = null) { |
||||
return $model !== null && $model->exists; |
||||
} |
||||
|
||||
/** |
||||
* Get a data array or value from the config data array |
||||
* |
||||
* @param string $key key in dot notation |
||||
* @param null $default default value if not defined |
||||
* @return mixed |
||||
*/ |
||||
function data($key, $default = null) |
||||
{ |
||||
return config("data.$key", $default); |
||||
} |
||||
|
||||
/** |
||||
* Wrap the argument in an array, if not an array already. |
||||
* Null becomes an empty array, array stays an array. |
||||
* Collection is converted to an array. |
||||
* |
||||
* @param mixed|mixed[]|null $oneOrMany |
||||
* @return array |
||||
*/ |
||||
function arr($oneOrMany) |
||||
{ |
||||
if (is_null($oneOrMany)) { |
||||
return []; |
||||
} |
||||
|
||||
if (is_array($oneOrMany)) { |
||||
return $oneOrMany; |
||||
} else if ($oneOrMany instanceof \Illuminate\Support\Collection) { |
||||
return $oneOrMany->toArray(); |
||||
} else { |
||||
return [$oneOrMany]; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Clamp value to given bounds |
||||
* |
||||
* @param float $value input |
||||
* @param float $min lower bound - included |
||||
* @param float $max upper bound - included |
||||
* @return float result |
||||
*/ |
||||
function clamp($value, $min, $max) |
||||
{ |
||||
return Utils::clamp($value, $min, $max); |
||||
} |
||||
|
||||
function objCollect($value = null) |
||||
{ |
||||
return new ObjCollection($value); |
||||
} |
||||
|
||||
function mb_ucfirst($str) { |
||||
return Str::ucfirst($str); |
||||
} |
||||
|
||||
// "pipe sort" is like normal sort, but returns the sorted array |
||||
|
||||
/** "pipe sort" */ |
||||
function sorted($arr) { |
||||
sort($arr); |
||||
return $arr; |
||||
} |
||||
|
||||
/** natural "pipe sort" */ |
||||
function natsorted($arr, $cs=false) { |
||||
return collect($arr)->natSort($cs)->all(); |
||||
} |
||||
|
||||
/** natural "pipe sort" by prop or retriever */ |
||||
function natsorted_by($arr, $prop, $cs=false) { |
||||
return collect($arr)->natSortBy($prop, $cs)->all(); |
||||
} |
||||
|
||||
/** Preg match that returns the array */ |
||||
function preg_matched($pattern, $subject) { |
||||
$ar = []; |
||||
preg_match($pattern, $subject, $ar); |
||||
return $ar; |
||||
} |
||||
|
||||
/** |
||||
* Format a string using the {} syntax |
||||
* |
||||
* @param string $format |
||||
* @param array ...$replacements |
||||
* @return string |
||||
*/ |
||||
function fmt($format, ...$replacements) |
||||
{ |
||||
return Str::format($format, ...$replacements); |
||||
} |
||||
|
||||
/** |
||||
* Sleep milliseconds (complementary to sleep & usleep) |
||||
* |
||||
* @param int $millis ms to sleep |
||||
*/ |
||||
function msleep($millis) |
||||
{ |
||||
usleep(1000 * $millis); |
||||
} |
||||
|
||||
/** |
||||
* Sleep with a log message |
||||
* |
||||
* @param int $millis ms to sleep |
||||
*/ |
||||
function log_msleep($millis) |
||||
{ |
||||
Log::debug("Sleeping $millis ms"); |
||||
usleep(1000 * $millis); |
||||
} |
||||
|
||||
/** |
||||
* Sleep with a log message |
||||
* |
||||
* @param int $secs ms to sleep |
||||
*/ |
||||
function log_sleep($secs) |
||||
{ |
||||
Log::debug("Sleeping $secs s"); |
||||
sleep($secs); |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
#region Profiling |
||||
/** |
||||
* Start profiling |
||||
* |
||||
* @return float start time (token) |
||||
*/ |
||||
function prof_start() |
||||
{ |
||||
return Profiler::start(); |
||||
} |
||||
|
||||
/** |
||||
* End profiling |
||||
* |
||||
* @param float $token start time (from profiler_start()) |
||||
* @return float time elapsed |
||||
*/ |
||||
function prof_end($token) |
||||
{ |
||||
return Profiler::end($token); |
||||
} |
||||
|
||||
#endregion |
||||
|
||||
/** |
||||
* Simple (but not exhaustive) transliteration for natural sort etc. |
||||
* |
||||
* @param $string |
||||
* @return string |
||||
*/ |
||||
function simple_translit($string) { |
||||
static $table = [ |
||||
'Á' => 'A', 'á' => 'a', 'Č' => 'C', 'č' => 'c', 'Ď' => 'D', 'ď' => 'd', 'É' => 'E', |
||||
'é' => 'e', 'Ě' => 'E', 'ě' => 'e', 'Í' => 'I', 'í' => 'i', 'Ň' => 'N', 'ň' => 'n', |
||||
'Ó' => 'O', 'ó' => 'o', 'Ř' => 'R', 'ř' => 'r', 'Š' => 'S', 'š' => 's', 'Ť' => 'T', |
||||
'ť' => 't', 'Ú' => 'U', 'ú' => 'u', 'Ů' => 'U', 'ů' => 'u', 'Ý' => 'Y', 'ý' => 'y', |
||||
'Ž' => 'Z', 'ž' => 'z', 'ß' => 'ss', 'А' => 'a', 'а' => 'a', 'Б' => 'b', 'б' => 'b', |
||||
'В' => 'v', 'в' => 'v', 'Г' => 'g', 'г' => 'g', 'Д' => 'd', 'д' => 'd', 'Е' => 'e', |
||||
'е' => 'e', 'Ё' => 'e', 'ё' => 'e', 'Ж' => 'z', 'ж' => 'z', 'З' => 'z', 'з' => 'z', |
||||
'И' => 'i', 'и' => 'i', 'Й' => 'j', 'й' => 'j', 'К' => 'k', 'к' => 'k', 'Л' => 'l', |
||||
'л' => 'l', 'М' => 'm', 'м' => 'm', 'Н' => 'n', 'н' => 'n', 'О' => 'o', 'о' => 'o', |
||||
'П' => 'p', 'п' => 'p', 'Р' => 'r', 'р' => 'r', 'С' => 's', 'с' => 's', 'Т' => 't', |
||||
'т' => 't', 'У' => 'u', 'у' => 'u', 'Ф' => 'f', 'ф' => 'f', 'Х' => 'x', 'х' => 'x', |
||||
'Ц' => 'c', 'ц' => 'c', 'Ч' => 'ch', 'ч' => 'ch', 'Ш' => 'sh', 'ш' => 'sh', 'Щ' => 'shch', |
||||
'щ' => 'shch', 'Ы' => 'y', 'ы' => 'y', 'Э' => 'e', 'э' => 'e', 'Ю' => 'ju', 'ю' => 'ju', |
||||
'Я' => 'ja', 'я' => 'ja', |
||||
]; |
||||
|
||||
return strtr($string, $table); |
||||
} |
@ -0,0 +1,60 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* Laravel - A PHP Framework For Web Artisans |
||||
* |
||||
* @package Laravel |
||||
* @author Taylor Otwell <taylor@laravel.com> |
||||
*/ |
||||
|
||||
define('LARAVEL_START', microtime(true)); |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Register The Auto Loader |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Composer provides a convenient, automatically generated class loader for |
||||
| our application. We just need to utilize it! We'll simply require it |
||||
| into the script here so that we don't have to worry about manual |
||||
| loading any of our classes later on. It feels great to relax. |
||||
| |
||||
*/ |
||||
|
||||
require __DIR__.'/../vendor/autoload.php'; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Turn On The Lights |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| We need to illuminate PHP development, so let us turn on the lights. |
||||
| This bootstraps the framework and gets it ready for use, then it |
||||
| will load up this application so that we can run it and send |
||||
| the responses back to the browser and delight our users. |
||||
| |
||||
*/ |
||||
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php'; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Run The Application |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Once we have the application, we can handle the incoming request |
||||
| through the kernel, and send the associated response back to |
||||
| the client's browser allowing them to enjoy the creative |
||||
| and wonderful application we have prepared for them. |
||||
| |
||||
*/ |
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); |
||||
|
||||
$response = $kernel->handle( |
||||
$request = Illuminate\Http\Request::capture() |
||||
); |
||||
|
||||
$response->send(); |
||||
|
||||
$kernel->terminate($request, $response); |
@ -0,0 +1,4 @@ |
||||
{ |
||||
"/js/app.js": "/js/app.js", |
||||
"/css/app.css": "/css/app.css" |
||||
} |
@ -0,0 +1,2 @@ |
||||
User-agent: * |
||||
Disallow: |
@ -0,0 +1,22 @@ |
||||
|
||||
/** |
||||
* First we will load all of this project's JavaScript dependencies which |
||||
* includes Vue and other libraries. It is a great starting point when |
||||
* building robust, powerful web applications using Vue and Laravel. |
||||
*/ |
||||
|
||||
require('./bootstrap'); |
||||
|
||||
window.Vue = require('vue'); |
||||
|
||||
/** |
||||
* Next, we will create a fresh Vue application instance and attach it to |
||||
* the page. Then, you may begin adding components to this application |
||||
* or customize the JavaScript scaffolding to fit your unique needs. |
||||
*/ |
||||
|
||||
Vue.component('example-component', require('./components/ExampleComponent.vue')); |
||||
|
||||
const app = new Vue({ |
||||
el: '#app' |
||||
}); |
@ -0,0 +1,56 @@ |
||||
|
||||
window._ = require('lodash'); |
||||
window.Popper = require('popper.js').default; |
||||
|
||||
/** |
||||
* We'll load jQuery and the Bootstrap jQuery plugin which provides support |
||||
* for JavaScript based Bootstrap features such as modals and tabs. This |
||||
* code may be modified to fit the specific needs of your application. |
||||
*/ |
||||
|
||||
try { |
||||
window.$ = window.jQuery = require('jquery'); |
||||
|
||||
require('bootstrap'); |
||||
} catch (e) {} |
||||
|
||||
/** |
||||
* We'll load the axios HTTP library which allows us to easily issue requests |
||||
* to our Laravel back-end. This library automatically handles sending the |
||||
* CSRF token as a header based on the value of the "XSRF" token cookie. |
||||
*/ |
||||
|
||||
window.axios = require('axios'); |
||||
|
||||
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; |
||||
|
||||
/** |
||||
* Next we will register the CSRF Token as a common header with Axios so that |
||||
* all outgoing HTTP requests automatically have it attached. This is just |
||||
* a simple convenience so we don't have to attach every token manually. |
||||
*/ |
||||
|
||||
let token = document.head.querySelector('meta[name="csrf-token"]'); |
||||
|
||||
if (token) { |
||||
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; |
||||
} else { |
||||
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); |
||||
} |
||||
|
||||
/** |
||||
* Echo exposes an expressive API for subscribing to channels and listening |
||||
* for events that are broadcast by Laravel. Echo and event broadcasting |
||||
* allows your team to easily build robust real-time web applications. |
||||
*/ |
||||
|
||||
// import Echo from 'laravel-echo'
|
||||
|
||||
// window.Pusher = require('pusher-js');
|
||||
|
||||
// window.Echo = new Echo({
|
||||
// broadcaster: 'pusher',
|
||||
// key: process.env.MIX_PUSHER_APP_KEY,
|
||||
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
|
||||
// encrypted: true
|
||||
// });
|
@ -0,0 +1,23 @@ |
||||
<template> |
||||
<div class="container"> |
||||
<div class="row justify-content-center"> |
||||
<div class="col-md-8"> |
||||
<div class="card card-default"> |
||||
<div class="card-header">Example Component</div> |
||||
|
||||
<div class="card-body"> |
||||
I'm an example component. |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
mounted() { |
||||
console.log('Component mounted.') |
||||
} |
||||
} |
||||
</script> |
@ -0,0 +1,8 @@ |
||||
|
||||
// Body |
||||
$body-bg: #f5f8fa; |
||||
|
||||
// Typography |
||||
$font-family-sans-serif: "Raleway", sans-serif; |
||||
$font-size-base: 0.9rem; |
||||
$line-height-base: 1.6; |
@ -0,0 +1,14 @@ |
||||
|
||||
// Fonts |
||||
@import url("https://fonts.googleapis.com/css?family=Raleway:300,400,600"); |
||||
|
||||
// Variables |
||||
@import "variables"; |
||||
|
||||
// Bootstrap |
||||
@import '~bootstrap/scss/bootstrap'; |
||||
|
||||
.navbar-laravel { |
||||
background-color: #fff; |
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04); |
||||
} |
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Authentication Language Lines |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The following language lines are used during authentication for various |
||||
| messages that we need to display to the user. You are free to modify |
||||
| these language lines according to your application's requirements. |
||||
| |
||||
*/ |
||||
|
||||
'failed' => 'These credentials do not match our records.', |
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', |
||||
|
||||
]; |
@ -0,0 +1,19 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Pagination Language Lines |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The following language lines are used by the paginator library to build |
||||
| the simple pagination links. You are free to change them to anything |
||||
| you want to customize your views to better match your application. |
||||
| |
||||
*/ |
||||
|
||||
'previous' => '« Previous', |
||||
'next' => 'Next »', |
||||
|
||||
]; |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Password Reset Language Lines |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The following language lines are the default lines which match reasons |
||||
| that are given by the password broker for a password update attempt |
||||
| has failed, such as for an invalid token or invalid new password. |
||||
| |
||||
*/ |
||||
|
||||
'password' => 'Passwords must be at least six characters and match the confirmation.', |
||||
'reset' => 'Your password has been reset!', |
||||
'sent' => 'We have e-mailed your password reset link!', |
||||
'token' => 'This password reset token is invalid.', |
||||
'user' => "We can't find a user with that e-mail address.", |
||||
|
||||
]; |
@ -0,0 +1,146 @@ |
||||
<?php |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Validation Language Lines |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The following language lines contain the default error messages used by |
||||
| the validator class. Some of these rules have multiple versions such |
||||
| as the size rules. Feel free to tweak each of these messages here. |
||||
| |
||||
*/ |
||||
|
||||
'accepted' => 'The :attribute must be accepted.', |
||||
'active_url' => 'The :attribute is not a valid URL.', |
||||
'after' => 'The :attribute must be a date after :date.', |
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.', |
||||
'alpha' => 'The :attribute may only contain letters.', |
||||
'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.', |
||||
'alpha_num' => 'The :attribute may only contain letters and numbers.', |
||||
'array' => 'The :attribute must be an array.', |
||||
'before' => 'The :attribute must be a date before :date.', |
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.', |
||||
'between' => [ |
||||
'numeric' => 'The :attribute must be between :min and :max.', |
||||
'file' => 'The :attribute must be between :min and :max kilobytes.', |
||||
'string' => 'The :attribute must be between :min and :max characters.', |
||||
'array' => 'The :attribute must have between :min and :max items.', |
||||
], |
||||
'boolean' => 'The :attribute field must be true or false.', |
||||
'confirmed' => 'The :attribute confirmation does not match.', |
||||
'date' => 'The :attribute is not a valid date.', |
||||
'date_format' => 'The :attribute does not match the format :format.', |
||||
'different' => 'The :attribute and :other must be different.', |
||||
'digits' => 'The :attribute must be :digits digits.', |
||||
'digits_between' => 'The :attribute must be between :min and :max digits.', |
||||
'dimensions' => 'The :attribute has invalid image dimensions.', |
||||
'distinct' => 'The :attribute field has a duplicate value.', |
||||
'email' => 'The :attribute must be a valid email address.', |
||||
'exists' => 'The selected :attribute is invalid.', |
||||
'file' => 'The :attribute must be a file.', |
||||
'filled' => 'The :attribute field must have a value.', |
||||
'gt' => [ |
||||
'numeric' => 'The :attribute must be greater than :value.', |
||||
'file' => 'The :attribute must be greater than :value kilobytes.', |
||||
'string' => 'The :attribute must be greater than :value characters.', |
||||
'array' => 'The :attribute must have more than :value items.', |
||||
], |
||||
'gte' => [ |
||||
'numeric' => 'The :attribute must be greater than or equal :value.', |
||||
'file' => 'The :attribute must be greater than or equal :value kilobytes.', |
||||
'string' => 'The :attribute must be greater than or equal :value characters.', |
||||
'array' => 'The :attribute must have :value items or more.', |
||||
], |
||||
'image' => 'The :attribute must be an image.', |
||||
'in' => 'The selected :attribute is invalid.', |
||||
'in_array' => 'The :attribute field does not exist in :other.', |
||||
'integer' => 'The :attribute must be an integer.', |
||||
'ip' => 'The :attribute must be a valid IP address.', |
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.', |
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.', |
||||
'json' => 'The :attribute must be a valid JSON string.', |
||||
'lt' => [ |
||||
'numeric' => 'The :attribute must be less than :value.', |
||||
'file' => 'The :attribute must be less than :value kilobytes.', |
||||
'string' => 'The :attribute must be less than :value characters.', |
||||
'array' => 'The :attribute must have less than :value items.', |
||||
], |
||||
'lte' => [ |
||||
'numeric' => 'The :attribute must be less than or equal :value.', |
||||
'file' => 'The :attribute must be less than or equal :value kilobytes.', |
||||
'string' => 'The :attribute must be less than or equal :value characters.', |
||||
'array' => 'The :attribute must not have more than :value items.', |
||||
], |
||||
'max' => [ |
||||
'numeric' => 'The :attribute may not be greater than :max.', |
||||
'file' => 'The :attribute may not be greater than :max kilobytes.', |
||||
'string' => 'The :attribute may not be greater than :max characters.', |
||||
'array' => 'The :attribute may not have more than :max items.', |
||||
], |
||||
'mimes' => 'The :attribute must be a file of type: :values.', |
||||
'mimetypes' => 'The :attribute must be a file of type: :values.', |
||||
'min' => [ |
||||
'numeric' => 'The :attribute must be at least :min.', |
||||
'file' => 'The :attribute must be at least :min kilobytes.', |
||||
'string' => 'The :attribute must be at least :min characters.', |
||||
'array' => 'The :attribute must have at least :min items.', |
||||
], |
||||
'not_in' => 'The selected :attribute is invalid.', |
||||
'not_regex' => 'The :attribute format is invalid.', |
||||
'numeric' => 'The :attribute must be a number.', |
||||
'present' => 'The :attribute field must be present.', |
||||
'regex' => 'The :attribute format is invalid.', |
||||
'required' => 'The :attribute field is required.', |
||||
'required_if' => 'The :attribute field is required when :other is :value.', |
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.', |
||||
'required_with' => 'The :attribute field is required when :values is present.', |
||||
'required_with_all' => 'The :attribute field is required when :values is present.', |
||||
'required_without' => 'The :attribute field is required when :values is not present.', |
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.', |
||||
'same' => 'The :attribute and :other must match.', |
||||
'size' => [ |
||||
'numeric' => 'The :attribute must be :size.', |
||||
'file' => 'The :attribute must be :size kilobytes.', |
||||
'string' => 'The :attribute must be :size characters.', |
||||
'array' => 'The :attribute must contain :size items.', |
||||
], |
||||
'string' => 'The :attribute must be a string.', |
||||
'timezone' => 'The :attribute must be a valid zone.', |
||||
'unique' => 'The :attribute has already been taken.', |
||||
'uploaded' => 'The :attribute failed to upload.', |
||||
'url' => 'The :attribute format is invalid.', |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Custom Validation Language Lines |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may specify custom validation messages for attributes using the |
||||
| convention "attribute.rule" to name the lines. This makes it quick to |
||||
| specify a specific custom language line for a given attribute rule. |
||||
| |
||||
*/ |
||||
|
||||
'custom' => [ |
||||
'attribute-name' => [ |
||||
'rule-name' => 'custom-message', |
||||
], |
||||
], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Custom Validation Attributes |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| The following language lines are used to swap attribute place-holders |
||||
| with something more reader friendly such as E-Mail Address instead |
||||
| of "email". This simply helps us make messages a little cleaner. |
||||
| |
||||
*/ |
||||
|
||||
'attributes' => [], |
||||
|
||||
]; |
@ -0,0 +1,95 @@ |
||||
<!doctype html> |
||||
<html lang="{{ app()->getLocale() }}"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1"> |
||||
|
||||
<title>Laravel</title> |
||||
|
||||
<!-- Fonts --> |
||||
<link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css"> |
||||
|
||||
<!-- Styles --> |
||||
<style> |
||||
html, body { |
||||
background-color: #fff; |
||||
color: #636b6f; |
||||
font-family: 'Raleway', sans-serif; |
||||
font-weight: 100; |
||||
height: 100vh; |
||||
margin: 0; |
||||
} |
||||
|
||||
.full-height { |
||||
height: 100vh; |
||||
} |
||||
|
||||
.flex-center { |
||||
align-items: center; |
||||
display: flex; |
||||
justify-content: center; |
||||
} |
||||
|
||||
.position-ref { |
||||
position: relative; |
||||
} |
||||
|
||||
.top-right { |
||||
position: absolute; |
||||
right: 10px; |
||||
top: 18px; |
||||
} |
||||
|
||||
.content { |
||||
text-align: center; |
||||
} |
||||
|
||||
.title { |
||||
font-size: 84px; |
||||
} |
||||
|
||||
.links > a { |
||||
color: #636b6f; |
||||
padding: 0 25px; |
||||
font-size: 12px; |
||||
font-weight: 600; |
||||
letter-spacing: .1rem; |
||||
text-decoration: none; |
||||
text-transform: uppercase; |
||||
} |
||||
|
||||
.m-b-md { |
||||
margin-bottom: 30px; |
||||
} |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<div class="flex-center position-ref full-height"> |
||||
@if (Route::has('login')) |
||||
<div class="top-right links"> |
||||
@auth |
||||
<a href="{{ url('/home') }}">Home</a> |
||||
@else |
||||
<a href="{{ route('login') }}">Login</a> |
||||
<a href="{{ route('register') }}">Register</a> |
||||
@endauth |
||||
</div> |
||||
@endif |
||||
|
||||
<div class="content"> |
||||
<div class="title m-b-md"> |
||||
Laravel |
||||
</div> |
||||
|
||||
<div class="links"> |
||||
<a href="https://laravel.com/docs">Documentation</a> |
||||
<a href="https://laracasts.com">Laracasts</a> |
||||
<a href="https://laravel-news.com">News</a> |
||||
<a href="https://forge.laravel.com">Forge</a> |
||||
<a href="https://github.com/laravel/laravel">GitHub</a> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,18 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Http\Request; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| API Routes |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here is where you can register API routes for your application. These |
||||
| routes are loaded by the RouteServiceProvider within a group which |
||||
| is assigned the "api" middleware group. Enjoy building your API! |
||||
| |
||||
*/ |
||||
|
||||
Route::middleware('auth:api')->get('/user', function (Request $request) { |
||||
return $request->user(); |
||||
}); |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Broadcast Channels |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here you may register all of the event broadcasting channels that your |
||||
| application supports. The given channel authorization callbacks are |
||||
| used to check if an authenticated user can listen to the channel. |
||||
| |
||||
*/ |
||||
|
||||
Broadcast::channel('App.User.{id}', function ($user, $id) { |
||||
return (int) $user->id === (int) $id; |
||||
}); |
@ -0,0 +1,18 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Foundation\Inspiring; |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Console Routes |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This file is where you may define all of your Closure based console |
||||
| commands. Each Closure is bound to a command instance allowing a |
||||
| simple approach to interacting with each command's IO methods. |
||||
| |
||||
*/ |
||||
|
||||
Artisan::command('inspire', function () { |
||||
$this->comment(Inspiring::quote()); |
||||
})->describe('Display an inspiring quote'); |
@ -0,0 +1,16 @@ |
||||
<?php |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Web Routes |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Here is where you can register web routes for your application. These |
||||
| routes are loaded by the RouteServiceProvider within a group which |
||||
| contains the "web" middleware group. Now create something great! |
||||
| |
||||
*/ |
||||
|
||||
Route::get('/', function () { |
||||
return view('welcome'); |
||||
}); |
@ -0,0 +1,21 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* Laravel - A PHP Framework For Web Artisans |
||||
* |
||||
* @package Laravel |
||||
* @author Taylor Otwell <taylor@laravel.com> |
||||
*/ |
||||
|
||||
$uri = urldecode( |
||||
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) |
||||
); |
||||
|
||||
// This file allows us to emulate Apache's "mod_rewrite" functionality from the |
||||
// built-in PHP web server. This provides a convenient way to test a Laravel |
||||
// application without having installed a "real" web server software here. |
||||
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { |
||||
return false; |
||||
} |
||||
|
||||
require_once __DIR__.'/public/index.php'; |
@ -0,0 +1,3 @@ |
||||
* |
||||
!public/ |
||||
!.gitignore |
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
@ -0,0 +1,8 @@ |
||||
config.php |
||||
routes.php |
||||
schedule-* |
||||
compiled.php |
||||
services.json |
||||
events.scanned.php |
||||
routes.scanned.php |
||||
down |
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue