public function onSubmitData() { $bool = $this->checkifexists(); if ($bool != 0) { if (post('image') == null || post('title') == null || post('articleurl') == null || post('image') == 'No Image' || post('title') == 'No Title' || post('articleurl') == 'No Url') { return 'Error'; } // if ( $this->isImage(post('image')) && $this->isValidUrl(post('articleurl')) ) { $data['image'] = $image = trim(post('image')); $data['title'] = $title = trim(post('title')); $data['url'] = $url = trim(post('articleurl')); // }else{ // return 'Error'; // } $db = new Article(); $db->user_email = $data['email'] = Auth::getUser()->email; $db->user_name = $data['username'] = Auth::getUser()->name; $db->article_title = $title; $db->article_image = $image; $db->article_url = $url; $db->save(); $articles = Article::take($this->property('take'))->orderBy('id', 'desc')->get(); $this->articles = $articles; return 'OK'; } else { return 'Already'; } }