Rubenwouters\CrmLauncher\Controllers\PublishController::insertPublishment PHP Method

insertPublishment() private method

Insert publishment in DB
private insertPublishment ( string $type, array $publication, string $content )
$type string
$publication array
$content string
    private function insertPublishment($type, $publication, $content)
    {
        if ($this->publishment->double($content)->exists()) {
            $publishment = $this->publishment->double($content)->first();
        } else {
            $publishment = new Publishment();
        }
        $publishment->user_id = Auth::user()->id;
        $publishment->content = $content;
        if ($type == self::TYPE_TWITTER) {
            $publishment->tweet_id = $publication['id_str'];
            $publishment->post_date = changeDateFormat($publication['created_at']);
        } else {
            if ($type == self::TYPE_FACEBOOK) {
                $publishment->fb_post_id = $publication->id;
                $publishment->post_date = Carbon::now();
            }
        }
        $publishment->save();
    }