-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from DissNik/2.0-components
2.0 components
- Loading branch information
Showing
4 changed files
with
65 additions
and
1 deletion.
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
49 changes: 49 additions & 0 deletions
49
resources/views/pages/ru/components/decoration_fragment.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,49 @@ | ||
<x-page | ||
title="Декоратор Fragment" | ||
:sectionMenu="[ | ||
'Разделы' => [ | ||
['url' => '#make', 'label' => 'Make'], | ||
] | ||
]" | ||
> | ||
|
||
<x-sub-title id="make">Make</x-sub-title> | ||
|
||
<x-p> | ||
Иногда может потребоваться вернуть только часть шаблона в вашем HTTP ответе. Для это можно воспользоваться | ||
<x-link link="https://laravel.com/docs/blade#rendering-blade-fragments" target="_blank">Blade Fragments</x-link>.<br /> | ||
Декоратор <em>Fragment</em> позволяет создавать соответствующие блоки. | ||
</x-p> | ||
|
||
<x-p> | ||
Создать <em>Fragment</em> можно воспользовавшись статическим методом <code>make()</code>. | ||
</x-p> | ||
|
||
<x-code language="php"> | ||
make(array $fields = []) | ||
</x-code> | ||
|
||
<x-p> | ||
Метод <code>name()</code> задает название для фрагмента. | ||
</x-p> | ||
|
||
<x-code language="php"> | ||
use MoonShine\Decorations\Fragment; // [tl! focus] | ||
use MoonShine\Fields\Text; | ||
|
||
//... | ||
|
||
public function components(): array | ||
{ | ||
return [ | ||
Fragment::make([ // [tl! focus] | ||
Text::make('Name', 'first_name') | ||
]) | ||
->name('fragment-name') // [tl! focus] | ||
]; | ||
} | ||
|
||
//... | ||
</x-code> | ||
|
||
</x-page> |
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