getSize() > 5000000) { return false; } } } return true; }); //Add tags for notes Note::created(function ($note) { $noteprep = new NotePrep(); $tagsToAdd = []; $tags = $noteprep->getTags($note->note); foreach ($tags as $text) { $tag = Tag::firstOrCreate(['tag' => $text]); $tagsToAdd[] = $tag->id; } if (count($tagsToAdd > 0)) { $note->tags()->attach($tagsToAdd); } }); } /** * Register any application services. * * @return void */ public function register() { // } }