/** * Register a view file namespace. * * @param string $path * @param string $namespace * @return void */ protected function loadViewsFrom($path, $namespace) { if (is_dir($appPath = $this->app->basePath() . '/resources/views/vendor/' . $namespace)) { $this->app['view']->addNamespace($namespace, $appPath); } $this->app['view']->addNamespace($namespace, $path); }
/** * Load factories for active modules * * @param $factory */ public function loadFactories($factory) { $this->withFactories()->each(function ($module) use($factory) { /* @var Module $module */ $this->loadFactoryFile($this->app->basePath() . DIRECTORY_SEPARATOR . $module->factoryFilePath(), $factory); }); }
/** * @param string $name * * @return string */ public function path($name = null) { if ($name !== null) { return $this->path() . '/' . $name; } else { return $this->app->basePath() . '/' . $this->app['config']->get('addon.path', 'addons'); } }
/** * @throws \RuntimeException */ private function setNamespace() { $composer = json_decode(file_get_contents($this->laravel->basePath() . '/composer.json'), true); foreach ((array) data_get($composer, 'autoload.psr-4') as $namespace => $path) { foreach ((array) $path as $pathChoice) { if (realpath($this->laravel->basePath() . DIRECTORY_SEPARATOR . 'app') == realpath($this->laravel->basePath() . '/' . $pathChoice)) { return $this->namespace = $namespace . $this->name; } } } throw new RuntimeException('Unable to detect application namespace.'); }
/** * Bootstrap the given application. * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { try { Dotenv::load($app->basePath(), $app->environmentFile()); } catch (InvalidArgumentException $e) { // } $app->detectEnvironment(function () { return env('APP_ENV', 'production'); }); }
/** * index. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Recca0120\Terminal\Kernel $kernel * @param \Illuminate\Http\Request $request * @param \Illuminate\Contracts\Response\Factory $responseFactory * @param \Illuminate\Contracts\Routing\UrlGenerator $urlGenerator * @param string $view * * @return mixed */ public function index(Application $app, Kernel $kernel, Request $request, ResponseFactory $responseFactory, UrlGenerator $urlGenerator, $view = 'index') { $kernel->call('--ansi'); $csrfToken = null; if ($request->hasSession() === true) { $csrfToken = $request->session()->token(); } $options = json_encode(['csrfToken' => $csrfToken, 'username' => 'LARAVEL', 'hostname' => php_uname('n'), 'os' => PHP_OS, 'basePath' => $app->basePath(), 'environment' => $app->environment(), 'version' => $app->version(), 'endpoint' => $urlGenerator->action('\\' . static::class . '@endpoint'), 'helpInfo' => $kernel->output(), 'interpreters' => ['mysql' => 'mysql', 'artisan tinker' => 'tinker', 'tinker' => 'tinker'], 'confirmToProceed' => ['artisan' => ['migrate', 'migrate:install', 'migrate:refresh', 'migrate:reset', 'migrate:rollback', 'db:seed']]]); $id = $view === 'panel' ? Str::random(30) : null; return $responseFactory->view('terminal::' . $view, compact('options', 'resources', 'id')); }
/** * Create a new console kernel instance. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Contracts\Events\Dispatcher $events * * @return void */ public function __construct(Application $app, Dispatcher $events) { // Used in `functions.php` so that we know we can stop from launching // the whole theme when in `Console-Mode`, because our goal is to use // some of the functions of WordPress. if (!defined('ARTISAN_BINARY')) { define('ARTISAN_BINARY', 'artisan'); } // Load WordPress so we can use those functions WordPress supplies for us. if (!defined('WP_USE_THEMES')) { define('WP_USE_THEMES', false); } $wp_load = realpath($app->basePath() . '/../../../wp-load.php'); if (file_exists($wp_load)) { require_once $wp_load; } parent::__construct($app, $events); }
/** * Register The October Auto Loader * * @param \Illuminate\Contracts\Foundation\Application $app * @return void */ public function bootstrap(Application $app) { ClassLoader::register(); ClassLoader::addDirectories([$app->basePath() . '/modules', $app->basePath() . '/plugins']); }
protected function publishAssets() { $this->filesystem->copyDirectory($this->application->basePath() . '/vendor/components/font-awesome/fonts', $this->application->publicPath() . '/assets/fonts'); }
/** * get relative path. * * @param \Illuminate\Contracts\Foundation\Application $app * * @return string */ public function relativePath(Application $app) { return substr($this->path, strlen($app->basePath()) + 1); }
protected function publishAssets() { $this->filesystem->copyDirectory(__DIR__ . '/../../../assets', $this->application->basePath() . '/assets'); }
function let(Application $laravel) { $laravel->basePath()->willReturn(__DIR__ . DIRECTORY_SEPARATOR . 'stubs'); $this->beConstructedWith($laravel); }
/** * Construct a new documentation processor. * * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Contracts\Config\Repository $config * @param \App\Documentation\FileLoader $loader */ public function __construct(Application $app, Config $config, FileLoader $loader) { $this->basePath = $app->basePath(); $this->config = $config; $this->loader = $loader; }
/** * The plugins path. * * @return string */ protected function getPluginsDir() { return $this->app->basePath() . '/plugins'; }