protected function createPublisherRelation()
 {
     try {
         $publisher = Publisher::findOrFail(array_get($this->input, 'publisher_id', null));
         $this->object->publisher()->associate($publisher);
     } catch (ModelNotFoundException $e) {
         // Model not found, do not set
     }
 }
 public function create()
 {
     DB::transaction(function () {
         $this->object = Object::create(['user_id' => Auth::id(), 'type' => MissionControlType::Article, 'subtype' => MissionControlSubtype::PressRelease, 'title' => $this->input['title'], 'size' => strlen($this->input['article']), 'article' => $this->input['article'], 'cryptographic_hash' => hash('sha256', $this->input['article']), 'originated_at' => \Carbon\Carbon::now(), 'publisher_id' => Publisher::where('name', 'SpaceX')->first()->publisher_id, 'status' => ObjectPublicationStatus::QueuedStatus]);
         $this->createMissionRelation();
         $this->createTagRelations();
         $this->object->push();
     });
     return $this->object;
 }
 public function delete($publisher_id)
 {
     Publisher::find($publisher_id)->delete();
     return response()->json(null, 204);
 }
 public function show()
 {
     JavaScript::put(['tags' => Tag::all(), 'missions' => Mission::with('featuredImage')->get(), 'publishers' => Publisher::all()]);
     return view('missionControl.create', ['recentUploads' => Object::inMissionControl()->orderBy('created_at', 'desc')->take(10)->get()]);
 }