If you are worried about SEO, then having a URL slug in the database is the way to go. Having the ID in the URL isn't very helpful to search engines or users. This should also simplify your code as well. In addition to that, you should take a look at Eloquent relationships where you can attach your users to locations. Instead of having
$author = User::find($location->author);
You could have
$author = $location->author;
The relationship would be a User hasMany
Locations, and Location belongsTo
User. This is also assuming that users can have many locations.