getSize() > 5000000) { return false; } } } return true; }); //Add tags for notes Note::created(function ($note) { $tagsToAdd = []; preg_match_all('/#([^\s<>]+)\b/', $note, $tags); foreach ($tags[1] as $tag) { $tag = Tag::normalizeTag($tag); } $tags = array_unique($tags[1]); foreach ($tags as $tag) { $tag = Tag::firstOrCreate(['tag' => $tag]); $tagsToAdd[] = $tag->id; } if (count($tagsToAdd > 0)) { $note->tags()->attach($tagsToAdd); } }); //allow micropub use in development if (env('APP_DEBUG') == true) { $tokenService = new \App\Services\TokenService(); $token = $tokenService->getNewToken([ 'me' => 'https://jonnybarnes.localhost', 'client_id' => 'https://jonnybarnes.localhost/notes/new', 'scope' => 'post' ]); session(['me' => 'https://jonnybarnes.localhost']); session(['token' => 'abc123']); } } /** * Register any application services. * * @return void */ public function register() { // } }