public function run() { DB::table('notification_types')->delete(); $collection = [['type' => 'comment', 'icon' => 'comment'], ['type' => 'registration', 'icon' => 'plus'], ['type' => 'message', 'icon' => 'envelope'], ['type' => 'auction', 'icon' => 'shopping-cart'], ['type' => 'watchlist', 'icon' => 'eye']]; foreach ($collection as $record) { Notificationtype::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Notificationtype::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }