/**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     //
     BaseSeeder::disableForeignKeyGuard();
     Schema::dropIfExists(Message::getTableName());
     BaseSeeder::enableForeignKeyGuard();
 }
 /**
  * @return array
  */
 public function getIndex()
 {
     $aKeys = Message::with(['key'])->get();
     $resource = new Collection($aKeys, new MessageTransformer(), "message");
     $manager = new Manager();
     //        $manager->setSerializer(new DataArraySerializer());
     $manager->setSerializer(new JsonApiSerializer());
     // Run all transformers
     $aReturn = $manager->createData($resource)->toArray();
     return $aReturn;
 }
예제 #3
0
 public function performSeeding()
 {
     Key::truncate();
     /*
      * Truncate the Message Seeder
      */
     Message::truncate();
     /*
      * Create the locale
      */
     factory(Key::class, 5)->create();
 }
 /**
  *
  */
 public function performSeeding()
 {
     /*
      * Truncate the Message Seeder
      */
     Message::truncate();
     $aKeys = Key::all()->lists(Key::getTablePrimaryKeyName());
     $aLocales = Locale::all()->lists(Locale::getTablePrimaryKeyName())->toArray();
     //        dd($aLocales);
     collect($aKeys)->each(function ($iKey) use($aLocales) {
         foreach ($aLocales as $iLocaleID) {
             $oMessage = factory(Message::class)->make();
             $oMessage->setAttribute(Message::COLUMN_LOCALE_ID, $iLocaleID);
             $oMessage->setAttribute(Message::COLUMN_KEY_ID, $iKey);
             $aMessage = $oMessage->toArray();
             // create the message
             Message::create($aMessage);
         }
     });
 }