$posts * @property-read int|null $posts_count * @property-read Collection $statuses * @property-read int|null $statuses_count * * @method static \Illuminate\Database\Eloquent\Builder|Place newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Place newQuery() * @method static \Illuminate\Database\Eloquent\Builder|Place query() * @method static \Illuminate\Database\Eloquent\Builder|Place whereAliases($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereCachedPostCount($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereCountry($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereCreatedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereId($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereLastCheckedAt($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereLat($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereLong($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereName($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereScore($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereSlug($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereState($value) * @method static \Illuminate\Database\Eloquent\Builder|Place whereUpdatedAt($value) * * @mixin \Eloquent */ class Place extends Model { protected $visible = ['id', 'name', 'country', 'slug']; public function url() { return url('/discover/places/'.$this->id.'/'.$this->slug); } public function posts() { return $this->hasMany(Status::class); } public function postCount() { return $this->posts()->count(); } public function statuses() { return $this->hasMany(Status::class, 'id', 'place_id'); } public function countryUrl() { $country = strtolower($this->country); $country = urlencode($country); return url('/discover/location/country/'.$country); } public function cityUrl() { return $this->url(); } public function getName(): string { return $this->name.', '.$this->country; } }