From 01173bfd4f874baef188a60c996a5124fde0c92d Mon Sep 17 00:00:00 2001 From: Loz Calver Date: Tue, 12 Nov 2024 14:25:42 +0000 Subject: [PATCH] Add IsFirst/IsLast methods to match SS5 conventions (closes #1274) --- src/Models/BaseElement.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Models/BaseElement.php b/src/Models/BaseElement.php index daf287e8..9a678188 100644 --- a/src/Models/BaseElement.php +++ b/src/Models/BaseElement.php @@ -1231,22 +1231,26 @@ public function getPageTitle() return null; } - /** - * @return boolean - */ - public function First() + public function IsFirst(): bool { return ($this->Parent()->Elements()->first()->ID === $this->ID); } - /** - * @return boolean - */ - public function Last() + public function First() + { + return $this->IsFirst(); + } + + public function IsLast(): bool { return ($this->Parent()->Elements()->last()->ID === $this->ID); } + public function Last() + { + return $this->IsLast(); + } + /** * @return int */