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


PHP app函数代码示例

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


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

示例1: resolveIdsToNames

 /**
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function resolveIdsToNames(Request $request)
 {
     $ids = array_unique(explode(',', $request->ids));
     // Init the initial return array
     $response = [];
     // Populate any entries from the cache
     foreach ($ids as $id) {
         if (Cache::has($this->prefix . $id)) {
             $response[$id] = Cache::get($this->prefix . $id);
             unset($ids[$id]);
         }
     }
     // Call the EVE API for any outstanding ids that need
     // resolution
     if (!empty($ids)) {
         $pheal = app()->make('Seat\\Eveapi\\Helpers\\PhealSetup')->getPheal();
         foreach (array_chunk($ids, 30) as $id_chunk) {
             $names = $pheal->eveScope->CharacterName(['ids' => implode(',', $id_chunk)]);
             foreach ($names->characters as $result) {
                 Cache::forever($this->prefix . $result->characterID, $result->name);
                 $response[$result->characterID] = $result->name;
             }
         }
     }
     return response()->json($response);
 }
开发者ID:eveseat,项目名称:web,代码行数:31,代码来源:ResolveController.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $this->info('Migrating modules');
     // Get all modules or 1 specific
     if ($moduleName = $this->input->getArgument('module')) {
         $modules = array(app('modules')->module($moduleName));
     } else {
         $modules = app('modules')->modules();
     }
     foreach ($modules as $module) {
         if ($module) {
             if ($this->app['files']->exists($module->path('migrations'))) {
                 // Prepare params
                 $path = ltrim(str_replace(app()->make('path.base'), '', $module->path()), "/") . "/migrations";
                 $_info = array('path' => $path);
                 // Add to migration list
                 array_push($this->migrationList, $_info);
                 $this->info("Added '" . $module->name() . "' to migration list.");
             } else {
                 $this->line("Module <info>'" . $module->name() . "'</info> has no migrations.");
             }
         } else {
             $this->error("Module '" . $moduleName . "' does not exist.");
         }
     }
     if (count($this->migrationList)) {
         $this->info("\n\t\t\t\tRunning Migrations...");
         // Process migration list
         $this->runPathsMigration();
     }
     if ($this->input->getOption('seed')) {
         $this->info("Running Seeding Command...");
         $this->call('modules:seed');
     }
 }
开发者ID:evertonteotonio,项目名称:laravel-modules,代码行数:40,代码来源:ModulesMigrateCommand.php

示例3: getValidatorFromClass

 protected function getValidatorFromClass($class)
 {
     $className = get_class($class);
     $validatorClassName = app()['config']['laracruds']['validators-path'] . '\\' . explode("\\", $className)[1] . app()['config']['laracruds']['validators-sufix'];
     $validatorClass = new $validatorClassName($class);
     return $validatorClass;
 }
开发者ID:sim-vzla,项目名称:laracruds,代码行数:7,代码来源:SearchValidators.php

示例4: create

 public function create(\Request $request)
 {
     $data = Request::json()->all();
     $issue_service = new IssueService(app(ConfigurationInterface::class));
     $url_parts = parse_url($data['worklog']['self']);
     $uri = $url_parts['path'];
     $regex = '~^/rest/api/./issue/(?P<issue_id>.*?)/(?P<ignore>.*?)/?$~';
     $matched = preg_match($regex, $uri, $matches);
     if (!$matched) {
         return null;
     }
     $issue = $issue_service->get($matches['issue_id']);
     $project_key = $issue->fields->project->key;
     $project = Project::whereJiraKey($project_key)->first();
     $employee = Staff::whereUserName($data['worklog']['author']['name'])->first();
     //return $project;
     $time_spent = $data['worklog']['timeSpentSeconds'];
     $started = $data['worklog']['started'];
     $timelog_jira_id = $data['worklog']['id'];
     $timelog = Timelog::whereJiraId($timelog_jira_id)->first();
     if ($timelog == null) {
         $timelog = new Timelog();
     }
     $timelog->project_id = $project->id;
     $timelog->staff_id = $employee->id;
     $timelog->started = $started;
     $timelog->time_spent = $time_spent;
     $timelog->jira_id = $timelog_jira_id;
     $timelog->save();
     //debugInfo($timelog);
     return $timelog;
 }
开发者ID:arsenaltech,项目名称:folio,代码行数:32,代码来源:TimelogController.php

示例5: __construct

 /**
  * Ready up blog repositories.
  */
 public function __construct()
 {
     $this->blogCategoriesRepository = app(CategoriesRepositoryInterface::class);
     $this->blogPostsRepository = app(PostsRepositoryInterface::class);
     $this->blogTagsRepository = app(TagsRepositoryInterface::class);
     $this->callConstructor();
 }
开发者ID:OzanKurt,项目名称:KurtModules-Blog,代码行数:10,代码来源:BlogController.php

示例6: down

 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     /* @var Builder $schema */
     $schema = app('db')->connection()->getSchemaBuilder();
     $schema->dropIfExists('streams_assignments');
     $schema->dropIfExists('streams_assignments_translations');
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:12,代码来源:2015_03_15_171720_create_assignments_tables.php

示例7: createMigration

 /**
  * Create the migration
  *
  * @param  string $name
  * @return bool
  */
 protected function createMigration()
 {
     //Create the migration
     $app = app();
     $migrationFiles = array($this->laravel->path . "/database/migrations/*_create_cities_table.php" => 'cities::generators.migration');
     $seconds = 0;
     foreach ($migrationFiles as $migrationFile => $outputFile) {
         if (sizeof(glob($migrationFile)) == 0) {
             $migrationFile = str_replace('*', date('Y_m_d_His', strtotime('+' . $seconds . ' seconds')), $migrationFile);
             $fs = fopen($migrationFile, 'x');
             if ($fs) {
                 $output = "<?php\n\n" . $app['view']->make($outputFile)->with('table', 'cities')->render();
                 fwrite($fs, $output);
                 fclose($fs);
             } else {
                 return false;
             }
             $seconds++;
         }
     }
     //Create the seeder
     $seeder_file = $this->laravel->path . "/database/seeds/CitiesSeeder.php";
     $output = "<?php\n\n" . $app['view']->make('cities::generators.seeder')->render();
     if (!file_exists($seeder_file)) {
         $fs = fopen($seeder_file, 'x');
         if ($fs) {
             fwrite($fs, $output);
             fclose($fs);
         } else {
             return false;
         }
     }
     return true;
 }
开发者ID:ferdirn,项目名称:laravel-id-cities,代码行数:40,代码来源:MigrationCommand.php

示例8: signMessage

 public function signMessage($address)
 {
     $input = Input::all();
     $output = array();
     if (!isset($input['message']) or trim($input['message']) == '') {
         $output['error'] = 'Message required';
         $output['result'] = false;
         return new Response($output, 400);
     }
     $get = PaymentAddress::where('uuid', $address)->orWhere('address', $address)->first();
     $found = false;
     if (!$get) {
         $output['error'] = 'Bitcoin address does not belong to server';
         $output['result'] = false;
         return new Response($output, 400);
     }
     $address = $get->address;
     $address_generator = app('Tokenly\\BitcoinAddressLib\\BitcoinAddressGenerator');
     $lib = new BitcoinLib();
     $priv_key = $address_generator->WIFPrivateKey($get->private_key_token);
     $priv_key = BitcoinLib::WIF_to_private_key($priv_key);
     $sign = $priv_key;
     try {
         $sign = $lib->signMessage($input['message'], $priv_key);
     } catch (Exception $e) {
         $sign = false;
     }
     if (!$sign) {
         $output['error'] = 'Error signing message';
         $output['result'] = false;
         return new Response($output, 500);
     }
     $output['result'] = $sign;
     return new Response($output);
 }
开发者ID:CryptArc,项目名称:xchain,代码行数:35,代码来源:AddressController.php

示例9: runCommand

 /**
  * @param  \Illuminate\Console\Command $command
  * @param  array $arguments
  * @return int
  */
 protected function runCommand(Illuminate\Console\Command $command, array $arguments = [])
 {
     $command->setLaravel(app());
     $input = new Symfony\Component\Console\Input\ArrayInput($arguments);
     $input->setInteractive(false);
     return $command->run($input, new Symfony\Component\Console\Output\NullOutput());
 }
开发者ID:tvad911,项目名称:laravel-addon-wordpress,代码行数:12,代码来源:ConsoleCommandTestCase.php

示例10: __construct

 public function __construct()
 {
     $this->assetManager = app(AssetManager::class);
     $this->assetPipeline = app(AssetPipeline::class);
     $this->addAssets();
     $this->requireDefaultAssets();
 }
开发者ID:mikemand,项目名称:Core,代码行数:7,代码来源:AdminBaseController.php

示例11: getDispatcher

 /**
  * Returns the event dispatcher.
  *
  * @return \Illuminate\Events\Dispatcher
  */
 public static function getDispatcher()
 {
     if (!isset(static::$dispatcher)) {
         static::$dispatcher = function_exists('app') ? app(Dispatcher::class) : forward_static_call_array('Illuminate\\Container\\Container::make', [Dispatcher::class]);
     }
     return static::$dispatcher;
 }
开发者ID:codexproject,项目名称:core,代码行数:12,代码来源:EventTrait.php

示例12: doProcessing

 /**
  * Performs the actual processing
  */
 protected function doProcessing()
 {
     $this->prepareProcessContext();
     // initialization process pipeline
     $initSteps = $this->initProcessSteps();
     if (!empty($initSteps)) {
         $this->context = app(Pipeline::class)->send($this->context)->through($initSteps)->then(function (ProcessContextInterface $context) {
             return $context;
         });
         $this->afterInitSteps();
     }
     // main pipeline (actual processing)
     $steps = $this->processSteps();
     if ($this->databaseTransaction) {
         DB::beginTransaction();
     }
     try {
         $this->context = app(Pipeline::class)->send($this->context)->through($steps)->then(function (ProcessContextInterface $context) {
             if ($this->databaseTransaction) {
                 DB::commit();
             }
             return $context;
         });
     } catch (Exception $e) {
         if ($this->databaseTransaction) {
             DB::rollBack();
         }
         $this->onExceptionInPipeline($e);
         throw $e;
     }
     $this->afterPipeline();
     $this->populateResult();
 }
开发者ID:czim,项目名称:laravel-processor,代码行数:36,代码来源:PipelineProcessor.php

示例13: refreshToken

 /**
  * Permintaan refresh token
  *
  * @param Request $request
  * @return array
  */
 public function refreshToken(Request $request)
 {
     $this->middleware('auth');
     $user = app('auth')->user();
     $newToken = JWTAuth::parseToken()->refresh();
     return ['status' => 'success', 'user' => $user, 'token' => $newToken];
 }
开发者ID:amteknologi,项目名称:e-commerce,代码行数:13,代码来源:LoginController.php

示例14: boot

 /**
  * Register any application authentication / authorization services.
  *
  * @param  \Illuminate\Contracts\Auth\Access\Gate  $gate
  * @return void
  */
 public function boot(GateContract $gate)
 {
     $this->registerPolicies($gate);
     app('auth')->provider('gladiator', function () {
         return new GladiatorUserProvider($this->app['hash'], config('auth.providers.gladiator.model'));
     });
 }
开发者ID:DoSomething,项目名称:gladiator,代码行数:13,代码来源:AuthServiceProvider.php

示例15: handle

 public function handle()
 {
     $reader = app('excel.reader');
     $reader->injectExcel(app('phpexcel'));
     $reader->_init($this->file);
     $filter = new ChunkReadFilter();
     $reader->reader->setLoadSheetsOnly($this->sheets);
     $reader->reader->setReadFilter($filter);
     $reader->reader->setReadDataOnly(true);
     // Set the rows for the chunking
     $filter->setRows($this->startRow, $this->chunkSize);
     // Load file with chunk filter enabled
     $reader->excel = $reader->reader->load($this->file);
     // Slice the results
     $results = $reader->get()->slice($this->startIndex, $this->chunkSize);
     $callback = $this->shouldQueue ? (new Serializer())->unserialize($this->callback) : $this->callback;
     // Do a callback
     if (is_callable($callback)) {
         $break = call_user_func($callback, $results);
     }
     $reader->_reset();
     unset($reader, $results);
     if ($break) {
         return true;
     }
 }
开发者ID:elvinas21,项目名称:BasketballFantasyLeague,代码行数:26,代码来源:ChunkedReadJob.php


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