Add some helper functions

This commit is contained in:
Deon George 2021-12-15 11:27:36 +11:00
parent 44fd2207fe
commit 0414760cf0
3 changed files with 25 additions and 0 deletions

View File

@ -239,6 +239,16 @@ class Blocks extends BlockKit
return $this->section(['text'=>$text]); return $this->section(['text'=>$text]);
} }
/**
* Add a spacer line
*
* @return $this
*/
public function addSpacer(): self
{
return $this->section(['text'=>Text::item(' ')]);
}
/** /**
* A context block * A context block
* *

View File

@ -42,6 +42,11 @@ class Channel extends Model
return Arr::get($this->attributes,'name') ?: $this->channel_id; return Arr::get($this->attributes,'name') ?: $this->channel_id;
} }
public function getSlackUrlAttribute(): string
{
return sprintf('<#%s>',$this->channel_id);
}
/* METHODS */ /* METHODS */
/** /**

View File

@ -24,6 +24,16 @@ class User extends Model
/* ATTRIBUTES */ /* ATTRIBUTES */
/**
* Is this user an admin
*
* @return bool
*/
public function getIsAdminAttribute(): bool
{
return $this->admin;
}
/** /**
* Return the user in slack response format * Return the user in slack response format
*/ */