public function createOrUpdate(Product $product) { if ($product === null) { return null; } $product->save(); if (\Request::input('note')) { $note = new Note(); $note->note = \Request::input('note'); $note->user_id = \Sentinel::getUser()->id; $note->created_by = \Sentinel::getUser()->id; $note->reference_type = 'articles'; $note->reference_id = $product->id; $note->save(); } return $product; }