/**
  * Handle the event.
  *
  * @param  AssignmentWasCreated  $event
  * @return void
  */
 public function handle(AssignmentWasCreated $event)
 {
     $assignment = $event->getAssignment();
     $stream = $assignment->getStream();
     foreach ($this->modules as $module) {
         if (in_array($stream->getNamespace(), _getNamespaces($module))) {
             $this->dispatch(new ModifyEntity($module, $stream, $assignment));
         }
     }
 }
 /**
  * Handle the event.
  *
  * @param AssignmentWasCreated $event
  */
 public function handle(AssignmentWasCreated $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof FilesFieldType) {
         return;
     }
     $table = $assignment->getStreamPrefix() . $assignment->getStreamSlug() . '_' . $fieldType->getField();
     $this->schema->dropIfExists($table);
     $this->schema->create($table, function (Blueprint $table) {
         $table->integer('entry_id');
         $table->integer('file_id');
         $table->integer('sort_order')->nullable();
         $table->primary(['entry_id', 'file_id']);
     });
 }
 /**
  * Handle the event.
  *
  * @param AssignmentWasCreated $event
  */
 public function handle(AssignmentWasCreated $event)
 {
     $assignment = $event->getAssignment();
     $fieldType = $assignment->getFieldType();
     if (!$fieldType instanceof MultipleFieldType) {
         return;
     }
     $table = array_get($fieldType->getConfig(), 'pivot_table', $assignment->getStreamPrefix() . $assignment->getStreamSlug() . '_' . $fieldType->getField());
     $foreignKey = $fieldType->getForeignKey();
     $otherKey = $fieldType->getOtherKey();
     $this->schema->dropIfExists($table);
     $this->schema->create($table, function (Blueprint $table) use($foreignKey, $otherKey) {
         $table->increments('id');
         $table->integer($foreignKey);
         $table->integer($otherKey);
     });
 }