【发布时间】:2013-08-12 14:09:28
【问题描述】:
我正在尝试保存到数据库,如果该帖子已经在数据库中,我希望忽略它。这就是我目前保存它的方式。 postid 必须是唯一的。
public function save($type, $postid, $url, $author, $content)
{
$post = new Post;
$post->type = $type;
$post->postid = $postid;
$post->url = $url;
$post->author = $author;
$post->content = $content;
echo $post;
$post->save();
}
【问题讨论】:
标签: laravel laravel-4 eloquent