message chat section

This commit is contained in:
amazuecos
2024-11-29 22:05:50 +01:00
parent c1aecb43f2
commit 2e767889ef
24 changed files with 615 additions and 105 deletions

View File

@ -10,7 +10,7 @@ class ChatDeparmentModel extends Model
protected $table = 'chat_departments';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $returnType = 'object';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
@ -126,4 +126,21 @@ class ChatDeparmentModel extends Model
->get()->getResultObject();
return $result;
}
public function getDisplay(int $chat_deparment_id) : string
{
return $this->find($chat_deparment_id)->display;
}
public function getChatDepartmentSelect(string $query = null)
{
$q = $this->builder()->select([
"id",
"display as name",
"description"
]);
if($query){
$q->orLike("display",$query)
->orLike("name",$query);
}
return $q;
}
}