本文整理汇总了PHP中Illuminate\Contracts\Foundation\Application::basePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::basePath方法的具体用法?PHP Application::basePath怎么用?PHP Application::basePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Contracts\Foundation\Application
的用法示例。
在下文中一共展示了Application::basePath方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadViewsFrom
/**
* 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);
}
示例2: loadFactories
/**
* 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);
});
}
示例3: path
/**
* @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');
}
}
示例4: setNamespace
/**
* @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.');
}
示例5: bootstrap
/**
* 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');
});
}
示例6: index
/**
* 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'));
}
示例7: __construct
/**
* 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);
}
示例8: bootstrap
/**
* 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']);
}
示例9: publishAssets
protected function publishAssets()
{
$this->filesystem->copyDirectory($this->application->basePath() . '/vendor/components/font-awesome/fonts', $this->application->publicPath() . '/assets/fonts');
}
示例10: relativePath
/**
* get relative path.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return string
*/
public function relativePath(Application $app)
{
return substr($this->path, strlen($app->basePath()) + 1);
}
示例11: publishAssets
protected function publishAssets()
{
$this->filesystem->copyDirectory(__DIR__ . '/../../../assets', $this->application->basePath() . '/assets');
}
示例12: let
function let(Application $laravel)
{
$laravel->basePath()->willReturn(__DIR__ . DIRECTORY_SEPARATOR . 'stubs');
$this->beConstructedWith($laravel);
}
示例13: __construct
/**
* 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;
}
示例14: getPluginsDir
/**
* The plugins path.
*
* @return string
*/
protected function getPluginsDir()
{
return $this->app->basePath() . '/plugins';
}