forked from moonshine-software/doc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(fields): updateOnPreview() method for Text, Checkbox and Select …
…fields
- Loading branch information
Showing
4 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
resources/views/pages/ru/fields/shared/update_on_preview.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<x-sub-title id="update-on-preview">Редактирование в preview</x-sub-title> | ||
|
||
<x-p> | ||
Метод <code>updateOnPreview()</code> позволяет редактировать поле <em>{{ $field }}</em> в режиме <em>preview</em>. | ||
</x-p> | ||
|
||
<x-code language="php"> | ||
updateOnPreview(?Closure $url = null, ?ResourceContract $resource = null, mixed $condition = null) | ||
</x-code> | ||
|
||
<x-p> | ||
<code>$url</code> - url для обработки асинхронного запроса,<br> | ||
<code>$resource</code> - ресурс модели на которую ссылается отношение,<br> | ||
<code>$condition</code> -условия выполнения метода. | ||
</x-p> | ||
|
||
<x-moonshine::alert type="default" icon="heroicons.information-circle"> | ||
Параметры не являются обязательными и их необходимо передавать, если поле работает вне ресурса. | ||
</x-moonshine::alert> | ||
|
||
<x-code language="php"> | ||
use MoonShine\Fields\{{ $field }}; | ||
|
||
//... | ||
|
||
public function fields(): array | ||
{ | ||
return [ | ||
{{ $field }}::make({!! $field === 'Checkbox' ? 'Public' : 'Country' !!}) | ||
->updateOnPreview() // [tl! focus] | ||
]; | ||
} | ||
|
||
//... | ||
</x-code> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters