It would be up to you define "what is a neighbor" and to implement that yourself.
You could start by making this a function on your Model, and refactor from there if you want a Repository pattern, or whatever you like.
It's up to you do define your concept of adjacency. If by next / prev you just want to go by ID's then you could do something like:
class Profile extends Model {
public function next() {
return self::find($this->id + 1);
}
public function prev() {
return self::find($this->id - 1);
}
}
The usage for this then would be when you're fetching Profiles:
php artisan tinker
>>> Profile::find(1)->prev()
=> null
>>> Profile::find(1)->next()
=> App\Profile {#2922
id: 2,
created_at: "2018-11-01 22:38:23",
updated_at: "2018-11-01 22:38:23",
}