public function updateContentById($id = 0, $data = array()) { if (empty($id)) { return false; } if (empty($data)) { return false; } $content_model = new ContentModel(); return $content_model->where('id', $id)->update($data); }
protected static function boot() { parent::boot(); static::creating(function ($article) { if ($article['username'] == null) { $article['username'] = Auth::user()->username; } }); }