public function removeCategory($cat_name) { if ($results = NotificationCategory::where('name', $cat_name)->first()) { $results->delete(); } }
public function setCategory() { try { //If Category exists get id $category = NotificationCategory::firstOrCreate(['id' => $this->getUuid(), 'name' => $this->getEventName(), 'description' => 'File Uploads Ready to Compare']); $this->category = $category->id; return $this; } catch (\Exception $e) { throw new \Exception(sprintf("Error making category %s", $e->getMessage())); } }