Replies: 1 comment 1 reply
-
Hi, do you want to get the value If it is on the screen, then you can use properties /**
* Query data.
*
* @return array
*/
public function query(): array
{
$this->userType = 2;
return [];
}
/**
* Views.
*
* @return Layout[]
*/
public function layout(): array
{
Layout::rows([
Select::make('mail.clients.')
->title("Recipients")
->multiple()
->placeholder('Email addresses')
->help('Enter the campaign designer accounts that you would like to send this mail to.')
->fromQuery(Client::where('type', '=', $this->userType), 'email'),
]);
} If you are using a separate class, then don't worry. You can also get all the values of the screen query: // screen
public function query(): array
{
return [
'userType' => 2
];
}
// Row layout class
class ClientRow extends Rows
{
/**
* Get the fields elements to be displayed.
*
* @return Field[]
*/
protected function fields(): array
{
return [
Select::make('mail.clients.')
->title("Recipients")
->multiple()
->placeholder('Email addresses')
->help('Enter the campaign designer accounts that you would like to send this mail to.')
->fromQuery(Client::where('type', '=', $this->query->get('userType')), 'email'),
];
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello guys!
I want to send emails to our customers by using Orchid at the company I work for. However, we classified these customers according to their level of authority. And we have to send these emails according to their authorization levels.
I can now select the customer information we got from the database with the select form according to the authorization level, but this is not dynamic. I can only take one group at a time.
Currently, It's working like this:
Client::where('type', '=', '1')
I want to make this '1' to dynamic. When I select type 2 for example, this part should looks like thisClient::where('type', '=', '2')
How can I do this?
Beta Was this translation helpful? Give feedback.
All reactions