当前位置: 首页>>代码示例>>PHP>>正文


PHP app_path函数代码示例

本文整理汇总了PHP中app_path函数的典型用法代码示例。如果您正苦于以下问题:PHP app_path函数的具体用法?PHP app_path怎么用?PHP app_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了app_path函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public static function run()
 {
     foreach (glob(app_path() . '/Http/Controllers/*.php') as $filename) {
         $file_parts = explode('/', $filename);
         $file = array_pop($file_parts);
         $file = rtrim($file, '.php');
         if ($file == 'Controller') {
             continue;
         }
         $controllerName = 'App\\Http\\Controllers\\' . $file;
         $controller = new $controllerName();
         if (isset($controller->exclude) && $controller->exclude === true) {
             continue;
         }
         $methods = [];
         $reflector = new \ReflectionClass($controller);
         foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $rMethod) {
             // check whether method is explicitly defined in this class
             if ($rMethod->getDeclaringClass()->getName() == $reflector->getName()) {
                 $methods[] = $rMethod->getName();
             }
         }
         \Route::resource(strtolower(str_replace('Controller', '', $file)), $file, ['only' => $methods]);
     }
 }
开发者ID:avnir,项目名称:easyrouting,代码行数:25,代码来源:Easyrouting.php

示例2: exists

 public function exists()
 {
     if (file_exists(app_path() . '/events/' . $this->name . '.php')) {
         return true;
     }
     return false;
 }
开发者ID:gxela,项目名称:leback-event,代码行数:7,代码来源:EventHandlerBase.php

示例3: make

 public function make($resource)
 {
     $controllerName = $this->getControllerName($resource);
     $path = app_path() . "/controllers/{$controllerName}.php";
     $template = $this->getTemplate($resource);
     $this->file->put($path, $template);
 }
开发者ID:nelug,项目名称:ControlDePlanilla,代码行数:7,代码来源:ControllerGenerator.php

示例4: publish_rules_file_creates_rules_file

 /**
  * @test
  */
 public function publish_rules_file_creates_rules_file()
 {
     $this->assertFileNotExists(app_path('Settings/Resources/Rules.php'));
     Artisan::call('pbag:rules');
     $this->assertFileExists(app_path('Settings/Resources/Rules.php'));
     File::deleteDirectory(app_path('Settings'));
 }
开发者ID:zachleigh,项目名称:laravel-property-bag,代码行数:10,代码来源:CommandTest.php

示例5: boot

 /**
  * Perform post-registration booting of services.
  *
  * @return void
  */
 public function boot()
 {
     if (!$this->app->routesAreCached()) {
         require __DIR__ . '/Http/routes.php';
     }
     $configFiles = ['job'];
     foreach ($configFiles as $config) {
         $this->mergeConfigFrom(__DIR__ . "/config/{$config}.php", 'job_market_manager');
     }
     $this->loadTranslationsFrom(__DIR__ . '/resources/lang', 'job_market_manager');
     $this->loadViewsFrom(__DIR__ . '/resources/views', 'job_market_manager');
     //Publish middleware
     // $this->publishes([
     //   __DIR__ . '/Middleware/' => app_path('Http/Middleware'),
     // ]);
     //Publish providers
     // $this->publishes([
     //   __DIR__ . '/Providers/' => app_path('Providers'),
     // ]);
     //Publish views
     $this->publishes([__DIR__ . '/resources/views' => resource_path('views')], 'views');
     //Publish translations
     $this->publishes([__DIR__ . '/resources/lang/' => resource_path('lang/')], 'translations');
     // Publish a config file
     $this->publishes([__DIR__ . '/config/job.php' => config_path('job.php')], 'config');
     //Publish migrations
     $this->publishes([__DIR__ . '/database/migrations' => database_path('migrations')], 'migrations');
     // $this->publishes([
     //   __DIR__.'/assets/bower_components/AdminLTE/' => public_path('/assets/bower_components/AdminLTE/'),
     // ], 'public');
     $this->publishes([__DIR__ . '/Http/Controllers/Admin/' => app_path('/Http/Controllers/Admin/')], 'controllers');
     $this->publishes([__DIR__ . '/Models/Admin/' => app_path()], 'models');
 }
开发者ID:meccado,项目名称:job-market-manager,代码行数:38,代码来源:JobMarketManagerServiceProvider.php

示例6: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/custom_routes.php');
         require app_path('Http/routes.php');
     });
 }
开发者ID:rbmowatt,项目名称:alohalbi.surf,代码行数:13,代码来源:RouteServiceProvider.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $parentFolder = app_path('database/migrations');
     $allFolder = scandir($parentFolder);
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     if (!empty($allFolder)) {
         $_fileService->remove($_tmpPath);
         foreach ($allFolder as $folder) {
             if (is_dir($parentFolder . '/' . $folder) && $folder != '.' && $folder != '..') {
                 $_fileService->mirror($parentFolder . '/' . $folder, $_tmpPath);
             }
         }
         $this->info("Migrating...");
         $this->call('migrate', array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/')));
         // Delete all temp migration files
         $this->info("Cleaning temporary files");
         $_fileService->remove($_tmpPath);
         // Done
         $this->info("DONE!");
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:31,代码来源:MigrateCommand.php

示例8: runPathsMigration

 /**
  * Run paths migrations
  *
  * @return void
  */
 protected function runPathsMigration()
 {
     $_fileService = new Filesystem();
     $_tmpPath = app_path('storage') . DIRECTORY_SEPARATOR . 'migrations';
     if (!is_dir($_tmpPath) && !$_fileService->exists($_tmpPath)) {
         $_fileService->mkdir($_tmpPath);
     }
     $this->info("Gathering migration files to {$_tmpPath}");
     // Copy all files to storage/migrations
     foreach ($this->migrationList as $migration) {
         $_fileService->mirror($migration['path'], $_tmpPath);
     }
     //call migrate command on temporary path
     $this->info("Migrating...");
     $opts = array('--path' => ltrim(str_replace(base_path(), '', $_tmpPath), '/'));
     if ($this->input->getOption('force')) {
         $opts['--force'] = true;
     }
     if ($this->input->getOption('database')) {
         $opts['--database'] = $this->input->getOption('database');
     }
     $this->call('migrate', $opts);
     // Delete all temp migration files
     $this->info("Cleaning temporary files");
     $_fileService->remove($_tmpPath);
     // Done
     $this->info("DONE!");
 }
开发者ID:evertonteotonio,项目名称:laravel-modules,代码行数:33,代码来源:ModulesMigrateCommand.php

示例9: __construct

 public function __construct($commandData)
 {
     $this->commandData = $commandData;
     $this->path = Config::get('generator.path_routes', app_path('Http/routes.php'));
     $this->apiPath = Config::get('generator.path_api_routes', app_path('Http/api_routes.php'));
     $this->useDingo = Config::get('generator.use_dingo_api', false);
 }
开发者ID:julioalves,项目名称:laravel-api-generator,代码行数:7,代码来源:RoutesGenerator.php

示例10: GenerateController

 protected function GenerateController()
 {
     $this->console->line('Generating Controller: ' . $this->controllerName);
     $controller = \View::file(__DIR__ . '/Templates/controller.blade.php', $this->templateData)->render();
     $path = app_path() . '/Http/Controllers/' . $this->controllerName . '.php';
     file_put_contents($path, $controller);
 }
开发者ID:Shadetheartist,项目名称:laravel-crud-generator,代码行数:7,代码来源:CrudGeneratorService.php

示例11: generateFile

 public function generateFile()
 {
     $command = 'generate:migration';
     $table = $this->mb->getTable();
     $new = array();
     $fields = array();
     foreach ($this->mb->getColumns() as $name => $column) {
         if (!Schema::hasColumn($table, $name)) {
             $new[] = $name;
             $format = sprintf('%s:%s', $name, $column->getType());
             if ($column->isNullable()) {
                 $format .= ':nullable';
             }
             $fields[] = $format;
         }
     }
     if (Schema::hasTable($table)) {
         $name = sprintf('add_%s_to_%s_table', implode('_', $new), Str::snake($table));
         if (!$fields) {
             return;
         }
     } else {
         $name = sprintf('create_%s_table', Str::snake($table));
     }
     $file = ucwords($name) . '.php';
     $path = app_path() . '/database/migrations' . '/' . $file;
     $fields = implode(', ', $fields);
     $created = $this->parse($name, $fields)->make($path, null);
 }
开发者ID:boyhagemann,项目名称:model,代码行数:29,代码来源:MigrationGenerator.php

示例12: __construct

 function __construct($commandData)
 {
     $this->commandData = $commandData;
     $this->path = Config::get('generator.path_routes', app_path('Http/routes.php'));
     $this->apiPrefix = Config::get('generator.api_prefix', 'api');
     $this->apiNamespace = Config::get('generator.namespace_api_controller', 'App\\Http\\Controllers\\API');
 }
开发者ID:padrinpanji,项目名称:laravel-api-generator,代码行数:7,代码来源:RoutesGenerator.php

示例13: register

 public function register()
 {
     $this->publishes([__DIR__ . '/../database/seeds/' => database_path('seeds')], 'seeds');
     $this->publishes([__DIR__ . '/../database/migrations/' => database_path('migrations')], 'migrations');
     $this->publishes([__DIR__ . '/../app/' => app_path()], 'app');
     $this->publishes([__DIR__ . '/../resources/views/' => resource_path('views')], 'views');
 }
开发者ID:unstoppablecarl,项目名称:laravel-content-pages-example,代码行数:7,代码来源:PagesExampleInstallerServiceProvider.php

示例14: configureAPIRoute

 /**
  * 配置 API 路由.
  */
 public function configureAPIRoute()
 {
     $api_router = app('Dingo\\Api\\Routing\\Router');
     $api_router->group(['version' => env('API_PREFIX'), 'namespace' => $this->api_namespace], function ($router) {
         require app_path('Http/api_routes.php');
     });
 }
开发者ID:bitqiu,项目名称:sweep-api,代码行数:10,代码来源:RouteServiceProvider.php

示例15: convertToString

 /**
  * Converts a station id to a station string. If the string cannot be converted,
  * null is returned.
  * @param $string
  * @return string or null
  */
 public static function convertToString($string)
 {
     // Fetch stations list to compare the station string with
     $json = \File::get(app_path() . "/stations.json");
     $data = json_decode($json);
     // For each station in the array of stations, attempt comparison
     foreach ($data->{"@graph"} as $station) {
         /*
          * TODO: write an array with station name alternates
          *
          * This also solves multilanguage issues since the strings are simply converted
          * to the proper id :) This way, we can make iRail multilanguage!
          *
          * $alternates = array(
          * "Gent-Sint-Pieters" => array('Ghent-Sint-Pieters', 'Gent Sint Pieters', 'Ghent Sint Pieters')
          * )
          */
         /*
          * Assuming we have a list of station name alternates, we can do even more
          * comparisons to ensure that this process is functional.
          * TODO: write a function that loops through station name alternates
          */
         /* If we can find the station name in the string of Nicola's records,
          * we can return the station data if we get a hit!
          * Arguably we need to check if there are multiple hits:
          * TODO: check for multiple hits when using strpos()
          */
         if (strpos($station->{"@id"}, $string) !== false) {
             return $station;
         }
     }
     return null;
 }
开发者ID:elroyK,项目名称:hyperRail,代码行数:39,代码来源:StationString.php


注:本文中的app_path函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。