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


PHP Definition::all方法代码示例

本文整理汇总了PHP中Definition::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Definition::all方法的具体用法?PHP Definition::all怎么用?PHP Definition::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Definition的用法示例。


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

示例1: handle

 public static function handle($uri)
 {
     $definitions = \Definition::all();
     // Polyfill
     if (!function_exists('array_column')) {
         function array_column($array, $column_name)
         {
             return array_map(function ($element) use($column_name) {
                 return $element[$column_name];
             }, $array);
         }
     }
     // Get unique properties
     $keywords = Definitions\KeywordController::getKeywordList($definitions);
     $languages = array_count_values(array_filter(array_column($definitions->toArray(), 'language')));
     $licenses = array_count_values(array_filter(array_column($definitions->toArray(), 'rights')));
     $themes = array_count_values(array_filter(array_column($definitions->toArray(), 'theme')));
     $publishers = array_count_values(array_filter(array_column($definitions->toArray(), 'publisher_name')));
     // Sort by "Popularity"
     // For alphabetical order: use ksort
     arsort($keywords);
     arsort($languages);
     arsort($licenses);
     arsort($themes);
     arsort($publishers);
     $view = \View::make('home')->with('title', 'Datasets | The Datatank')->with('page_title', 'Datasets')->with('keywords', $keywords)->with('languages', $languages)->with('licenses', $licenses)->with('themes', $themes)->with('publishers', $publishers)->with('definitions', $definitions);
     return \Response::make($view);
 }
开发者ID:tdt,项目名称:core,代码行数:28,代码来源:HomeController.php

示例2: getIndex

 /**
  * Admin.dataset.view
  */
 public function getIndex()
 {
     // Set permission
     Auth::requirePermissions('admin.dataset.view');
     // Get all definitions
     $definitions = \Definition::all();
     return \View::make('ui.datasets.list')->with('title', 'Dataset management | The Datatank')->with('definitions', $definitions);
 }
开发者ID:jalbertbowden,项目名称:core,代码行数:11,代码来源:DatasetController.php

示例3: testDeleteApi

 public function testDeleteApi()
 {
     // Delete the published definition for each test csv file.
     foreach ($this->test_data as $file) {
         $this->updateRequest('DELETE');
         $controller = \App::make('Tdt\\Core\\Definitions\\DefinitionController');
         $response = $controller->handle("csv/{$file}");
         $this->assertEquals(200, $response->getStatusCode());
     }
     // Check if everything is deleted properly.
     $definitions_count = \Definition::all()->count();
     $csv_count = \CsvDefinition::all()->count();
     $this->assertTrue($csv_count == 0);
     $this->assertTrue($definitions_count == 0);
 }
开发者ID:jalbertbowden,项目名称:core,代码行数:15,代码来源:CsvTest.php

示例4: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('definitions', function ($table) {
         $table->string('title', 255);
     });
     // Denormalize the definitions by copying the existing titles and descriptions
     foreach (\Definition::all() as $definition) {
         $source_model = new $definition->source_type();
         $source = $source_model->find($definition->source_id);
         if (!empty($source->title)) {
             $definition->title = $source->title;
         }
         if (!empty($source->description)) {
             $definition->description = $source->description;
         }
         $definition->save();
     }
 }
开发者ID:tdt,项目名称:core,代码行数:23,代码来源:2016_03_05_100154_denormalize_title_and_description_metadata.php

示例5: up

 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('definition_facet_types', function ($table) {
         $table->increments('id');
         $table->string('facet_name', 255);
     });
     $facet_types = ['rights', 'keyword', 'language', 'theme', 'publisher_name'];
     $facet_type_models = [];
     foreach ($facet_types as $facet) {
         $facet_type = \FacetType::create(['facet_name' => $facet]);
         $facet_type->save();
         if ($facet != 'keyword') {
             $facet_type_model[$facet] = $facet_type;
         } else {
             $facet_type_model['keywords'] = $facet_type;
         }
     }
     Schema::create('definition_facets', function ($table) {
         $table->increments('id');
         $table->integer('definition_id');
         $table->integer('facet_id');
         $table->string('facet_name');
         $table->string('value');
     });
     // Copy all of the facet related info to the new definition_facets table
     $definitions = \Definition::all();
     foreach ($definitions as $definition) {
         foreach ($facet_type_models as $facet_name => $facet_type) {
             if ($facet_name != 'keywords' && !empty($definition->{$facet_name})) {
                 $facet = \Facet::create(['definition_id' => $definition->id, 'facet_id' => $facet_type->id, 'facet_name' => $facet_name, 'value' => $definition->{$facet_name}]);
                 $facet->save();
             } else {
                 // split the keywords
                 if (!empty($definition->keywords)) {
                     $keywords = explode(',', $definition->keywords);
                     foreach ($keywords as $keyword) {
                         $facet = \Facet::create(['definition_id' => $definition->id, 'facet_id' => $facet_type->id, 'facet_name' => 'keyword', 'value' => $keyword]);
                         $facet->save();
                     }
                 }
             }
         }
     }
 }
开发者ID:tdt,项目名称:core,代码行数:49,代码来源:2016_04_06_144510_add_faceting_tables.php

示例6: count

 public function count()
 {
     return \Definition::all()->count();
 }
开发者ID:tdt,项目名称:core,代码行数:4,代码来源:DefinitionRepository.php

示例7: handle

 public static function handle($uri)
 {
     $definitions = \Definition::all();
     $view = \View::make('home')->with('title', 'Datasets | The Datatank')->with('page_title', 'Datasets')->with('definitions', $definitions);
     return \Response::make($view);
 }
开发者ID:jalbertbowden,项目名称:core,代码行数:6,代码来源:HomeController.php


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