/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $dataset = new \App\Dataset();
     $dataset->fill(['name' => 'test dataset', 'description' => '这是个测试数据集']);
     $dataset->save();
     for ($i = 0; $i < 10; $i++) {
         $si = new \App\StandardItem();
         $si->fill(['name' => 'test' . str_random(5), 'path' => 'test/' . str_random(10), 'dataset_id' => $dataset->id]);
         $si->save();
     }
 }
 Route::resource('values', 'ValuesController');
 Route::resource('charts', 'ChartsController');
 Route::resource('chartTypes', 'ChartTypesController');
 Route::resource('categories', 'CategoriesController');
 Route::resource('subcategories', 'SubcategoriesController');
 Route::resource('tags', 'TagsController');
 Route::resource('licenses', 'LicensesController');
 //Route::resource( 'dataValues', 'DataValuesController' );
 Route::bind('entities', function ($value, $route) {
     return App\Entity::whereId($value)->first();
 });
 Route::bind('datasources', function ($value, $route) {
     return App\Datasource::whereId($value)->first();
 });
 Route::bind('datasets', function ($value, $route) {
     return App\Dataset::whereId($value)->first();
 });
 Route::bind('variables', function ($value, $route) {
     return App\Variable::whereId($value)->first();
 });
 Route::bind('values', function ($value, $route) {
     return App\DataValue::whereId($value)->first();
 });
 Route::bind('charts', function ($value, $route) {
     return App\Chart::whereId($value)->first();
 });
 Route::bind('chartTypes', function ($value, $route) {
     return App\ChartType::whereId($value)->first();
 });
 Route::bind('categories', function ($value, $route) {
     return App\DatasetCategory::whereId($value)->first();
Пример #3
0
 private function saveMetamodel($tablename, $header, $data)
 {
     // save to datasets table
     $dataset = new \App\Dataset();
     $dataset->table_name = $tablename;
     $dataset->created_at = date("Y-m-d H:i:s");
     $dataset->updated_at = date("Y-m-d H:i:s");
     $dataset->save();
     // save to attributes table
     $this->saveAttributes($dataset, $tablename, $header, $data);
 }