public function create()
 {
     DB::transaction(function () {
         $twitterClient = new TwitterOAuth(Config::get('services.twitter.consumerKey'), Config::get('services.twitter.consumerSecret'), Config::get('services.twitter.accessToken'), Config::get('services.twitter.accessSecret'));
         // Fetch the tweet information from Twitter, if a tweet id was passed through (it is possible the tweet was created manually without an id)
         if (array_key_exists('tweet_id', $this->input)) {
             $tweet = $twitterClient->get('statuses/show', ['id' => $this->input['tweet_id']]);
             $tweetOwner = $tweet->user;
             $this->object = Object::create(['user_id' => Auth::id(), 'type' => MissionControlType::Tweet, 'tweet_text' => $tweet->text, 'tweet_id' => $tweet->id, 'tweet_parent_id' => $tweet->in_reply_to_status_id, 'size' => strlen($tweet->text), 'title' => $tweet->text, 'summary' => $this->input['summary'], 'cryptographic_hash' => hash('sha256', $tweet->text), 'originated_at' => Carbon::createFromFormat('D M d H:i:s P Y', $tweet->created_at)->toDateTimeString(), 'status' => ObjectPublicationStatus::QueuedStatus]);
         } else {
             $this->object = Object::create(['user_id' => Auth::id(), 'type' => MissionControlType::Tweet, 'tweet_text' => $this->input['tweet_text'], 'size' => strlen($this->input['tweet_text']), 'title' => $this->input['tweet_text'], 'summary' => $this->input['summary'], 'cryptographic_hash' => hash('sha256', $this->input['tweet_text']), 'originated_at' => $this->input['originated_at'], 'status' => ObjectPublicationStatus::QueuedStatus]);
         }
         try {
             if (!isset($tweetOwner)) {
                 $tweetOwner = $twitterClient->get('users/show', ['screen_name' => $this->input['tweet_screen_name']]);
             }
             $tweeter = Tweeter::byScreenName($tweetOwner->screen_name)->firstOrFail();
         } catch (ModelNotFoundException $e) {
             $tweeter = Tweeter::create(['screen_name' => $tweetOwner->screen_name, 'user_name' => $tweetOwner->name, 'description' => $tweetOwner->description]);
             $tweeter->saveProfilePicture();
         }
         $this->object->tweeter()->associate($tweeter);
         $this->createMissionRelation();
         $this->createTagRelations();
         $this->object->push();
     });
     return $this->object;
 }
 public function create()
 {
     DB::transaction(function () {
         $this->object = Object::create(['user_id' => Auth::id(), 'type' => MissionControlType::Text, 'title' => $this->input['title'], 'size' => strlen($this->input['summary']), 'summary' => $this->input['summary'], 'anonymous' => array_get($this->input, 'anonymous', false), 'cryptographic_hash' => hash('sha256', $this->input['summary']), 'originated_at' => Carbon::now(), 'original_content' => true, 'status' => ObjectPublicationStatus::QueuedStatus]);
         $this->createMissionRelation();
         $this->createTagRelations();
         $this->object->push();
     });
     return $this->object;
 }
 public function create()
 {
     DB::transaction(function () {
         $this->object = Object::create(['user_id' => Auth::id(), 'type' => MissionControlType::Comment, 'subtype' => MissionControlSubtype::NSFComment, 'title' => $this->input['title'], 'size' => strlen($this->input['comment']), 'summary' => $this->input['comment'], 'cryptographic_hash' => hash('sha256', $this->input['comment']), 'external_url' => $this->input['external_url'], 'originated_at' => \Carbon\Carbon::now(), 'status' => ObjectPublicationStatus::QueuedStatus]);
         $this->createMissionRelation();
         $this->createTagRelations();
         $this->object->push();
     });
     return $this->object;
 }
 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 addToMissionControl()
 {
     return Object::create(array('user_id' => \Auth::id(), 'type' => MissionControlType::Audio, 'size' => $this->fileinfo['size'], 'filetype' => $this->fileinfo['filetype'], 'mimetype' => $this->fileinfo['mime'], 'original_name' => $this->fileinfo['original_name'], 'filename' => $this->fileinfo['filename'], 'has_temporary_file' => true, 'cryptographic_hash' => $this->getCryptographicHash(), 'duration' => $this->getLength(), 'status' => ObjectPublicationStatus::NewStatus));
 }
 public function addToMissionControl()
 {
     $this->setThumbnails();
     return Object::create(array('user_id' => \Auth::id(), 'type' => MissionControlType::GIF, 'size' => $this->fileinfo['size'], 'filetype' => $this->fileinfo['filetype'], 'mimetype' => $this->fileinfo['mime'], 'original_name' => $this->fileinfo['original_name'], 'filename' => $this->fileinfo['filename'], 'thumb_filename' => $this->getThumbnail(), 'has_temporary_file' => true, 'has_temporary_thumbs' => true, 'cryptographic_hash' => $this->getCryptographicHash(), 'dimension_width' => $this->getDimensions('width'), 'dimension_height' => $this->getDimensions('height'), 'duration' => $this->getLength(), 'status' => ObjectPublicationStatus::NewStatus));
 }
 public function addToMissionControl()
 {
     $this->setThumbnails();
     return Object::create(array('user_id' => \Auth::id(), 'type' => MissionControlType::Image, 'size' => $this->fileinfo['size'], 'filetype' => $this->fileinfo['filetype'], 'mimetype' => $this->fileinfo['mime'], 'original_name' => $this->fileinfo['original_name'], 'filename' => $this->fileinfo['filename'], 'thumb_filename' => $this->fileinfo['filename'], 'has_temporary_file' => true, 'has_temporary_thumbs' => true, 'cryptographic_hash' => $this->getCryptographicHash(), 'dimension_width' => $this->getDimensions('width'), 'dimension_height' => $this->getDimensions('height'), 'coord_lat' => $this->exif->latitude(), 'coord_lng' => $this->exif->longitude(), 'camera_manufacturer' => $this->exif->cameraMake(), 'camera_model' => $this->exif->cameraModel(), 'exposure' => $this->exif->exposure(), 'aperture' => $this->exif->aperture(), 'ISO' => $this->exif->iso(), 'originated_at' => $this->exif->datetime(), 'originated_at_specificity' => !is_null($this->exif->datetime()) ? DateSpecificity::Datetime : null, 'status' => ObjectPublicationStatus::NewStatus));
 }
 public function addToMissionControl()
 {
     $this->setThumbnails();
     return Object::create(array('user_id' => \Auth::id(), 'type' => MissionControlType::Document, 'size' => $this->fileinfo['size'], 'filetype' => $this->fileinfo['filetype'], 'mimetype' => $this->fileinfo['mime'], 'original_name' => $this->fileinfo['original_name'], 'filename' => $this->fileinfo['filename'], 'thumb_filename' => $this->getThumbnail(), 'has_temporary_file' => true, 'has_temporary_thumbs' => $this->fileinfo['filetype'] == 'pdf' && $this->fileinfo['mime'] == 'application/pdf', 'cryptographic_hash' => $this->getCryptographicHash(), 'length' => $this->getPageCount(), 'status' => ObjectPublicationStatus::NewStatus));
 }