本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::requireOnce方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::requireOnce方法的具体用法?PHP Filesystem::requireOnce怎么用?PHP Filesystem::requireOnce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::requireOnce方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: map
/**
* Map additional routes.
*
* @param Filesystem $files
* @param Application $application
*/
public function map(Filesystem $files, Application $application)
{
// Include public routes.
if ($files->exists($routes = $application->getStoragePath('posts/routes.php'))) {
$files->requireOnce($routes);
} else {
$files->requireOnce(__DIR__ . '/../resources/routes.php');
}
}
示例2: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
\DB::statement('SET FOREIGN_KEY_CHECKS=0;');
foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) {
$this->filesystem->requireOnce($file);
$migrationClass = $this->classFinder->findClass($file);
$migration = new $migrationClass();
$migration->down();
$migration->up();
}
$this->info("Merx tables migrated.");
\DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
示例3: migrate
/**
* run package database migrations
*
* @return void
*/
public function migrate()
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files(__DIR__ . "/migrations") as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->up();
}
foreach ($fileSystem->files(__DIR__ . "/seeds") as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->run();
}
}
示例4: setUp
/**
* Pull in composer and register service provider
*/
public function setUp()
{
$filesystem = new Filesystem();
$filesystem->requireOnce(__DIR__ . "/vendor/autoload.php");
$list = new ProviderList(\Core::getFacadeApplication());
$list->registerProvider("\\Concrete\\DocumentationGenerator\\ServiceProvider");
}
示例5: loadAutoloader
/**
* Require composer's autoload file the packages.
*
* @return void
**/
protected function loadAutoloader($path)
{
$finder = new Finder();
$files = new Filesystem();
$autoloads = $finder->in($path)->files()->name('autoload.php')->depth('<= 3')->followLinks();
foreach ($autoloads as $file) {
$files->requireOnce($file->getRealPath());
}
}
示例6: register
public function register()
{
$vendorPath = base_path('packages/*/vendor');
$autoloads = static::findAutoloadFiles($vendorPath);
$files = new Filesystem();
foreach ($autoloads as $file) {
/** @var SplFileInfo $file */
$files->requireOnce($file->getRealPath());
}
}
示例7: migrate
/**
* run package database migrations
*
* @return void
*/
public function migrate()
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files(__DIR__ . "/../src/Commands") as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->fire();
}
}
示例8: migrateDatabaseFromPath
/**
* Run all database migrations from the specified path
*
* @param string $path
* @return void
*/
protected function migrateDatabaseFromPath($path)
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files($path) as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->up();
}
}
示例9: migrate
/**
* run package database migrations.
*/
public function migrate()
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files(__DIR__ . '/../../../../tests/NilPortugues/App/Migrations') as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->down();
(new $migrationClass())->up();
}
}
示例10: getMigrations
protected function getMigrations()
{
$migrations = [];
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files(__DIR__ . '/../migrations') as $file) {
$fileSystem->requireOnce($file);
$migrations[] = $classFinder->findClass($file);
}
return $migrations;
}
示例11: migrate
/**
* Run package database migrations.
*/
public function migrate()
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
foreach ($fileSystem->files(__DIR__ . '/App/database/migrations') as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->down();
(new $migrationClass())->up();
}
}
示例12: boot
/**
* Bootstrap any application services.
*
* @param Filesystem $filesystem
*/
public function boot(Filesystem $filesystem)
{
foreach ($filesystem->files(app_path('Libraries/Macros')) as $file) {
$filesystem->requireOnce($file);
}
if ($this->app->environment(['local'])) {
$this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
$this->app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class);
}
}
示例13: requireBootstrap
/**
*
*/
protected function requireBootstrap()
{
if (!$this->filesystem->isDirectory($this->bootstrapDirectory)) {
return;
}
$files = $this->finder->create()->files()->name('/^[^_].+\\.php$/')->in($this->bootstrapDirectory);
$files->sort(function ($a) {
return $a->getFilename() !== static::BOOTSRAP_FILE;
});
foreach ($files as $file) {
$this->filesystem->requireOnce($file);
}
}
示例14: migrate
/**
* Run package database migrations.
* Thanks http://stackoverflow.com/questions/27759301/setting-up-integration-tests-in-a-laravel-package
*
* @return void
*/
public function migrate()
{
$fileSystem = new Filesystem();
$classFinder = new ClassFinder();
$packageMigrations = $fileSystem->files(__DIR__ . "/../../src/Migrations");
$laravelMigrations = $fileSystem->files(__DIR__ . "/../../vendor/laravel/laravel/database/migrations");
$migrationFiles = array_merge($laravelMigrations, $packageMigrations);
foreach ($migrationFiles as $file) {
$fileSystem->requireOnce($file);
$migrationClass = $classFinder->findClass($file);
(new $migrationClass())->up();
}
}
示例15: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->disableForeignKeyChecks();
$migrationCount = 0;
foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) {
$this->filesystem->requireOnce($file);
$migrationClass = $this->classFinder->findClass($file);
$migration = new $migrationClass();
if ($this->option("refresh")) {
$migration->down();
}
try {
$migration->up();
$migrationCount++;
} catch (QueryException $ex) {
if (!$this->isTableAlreadyExistError($ex)) {
throw $ex;
}
}
}
$this->enableForeignKeyChecks();
$this->info("{$migrationCount} table(s) migrated.");
}