|
21 | 21 | - [Grid view](doc/grid-view.md) |
22 | 22 |
|
23 | 23 | # Version compatibility |
24 | | -|Laravel views|Livewire|Laravel| |
25 | | -|-|-|-| |
26 | | -|2.x|2.x|7.x, 8.x| |
27 | | -|1.x|1.x|5.x, 6.x| |
| 24 | +|Laravel views|Alpine|Livewire|Laravel| |
| 25 | +|-|-|-|-| |
| 26 | +|2.x|2.8.x|2.x|7.x, 8.x| |
| 27 | +|1.x|2.8.x|1.x|5.x, 6.x| |
28 | 28 |
|
29 | 29 | # Installation and basic usage |
30 | 30 |
|
@@ -69,24 +69,26 @@ You can specify which assets you want to include passing a string to those direc |
69 | 69 |
|
70 | 70 | ```php |
71 | 71 | @laravelViewsStyles(laravel-views,tailwindcss,livewire) |
| 72 | +@laravelViewsScripts(laravel-views,livewire,alpine) |
72 | 73 | ``` |
73 | 74 |
|
74 | | -If you dont need to include `Tailwindcss` or `Livewire` assets you can just set the `laravel-views` assets in the list. |
| 75 | +If you dont need to include `Tailwindcss`, `Livewire` or `Alpine` assets you can just set the `laravel-views` assets in the list. |
75 | 76 |
|
76 | 77 | ```php |
77 | 78 | @laravelViewsStyles(laravel-views) |
| 79 | +@laravelViewsScripts(laravel-views) |
78 | 80 | ``` |
79 | 81 |
|
| 82 | +This is recomended for a production environment where you surely have a compile assets pipeline, like Laravel Mix, or you want to include the assets from a CDN on your own. |
| 83 | + |
80 | 84 | ## Purge Tailwindcss styles |
81 | 85 | If you're using your own Tailwindcss setup you must consider `laravel-views` in your `purge` configuration, for that just add this path to the `purge` array on the `tailwind.config.js`file. |
82 | 86 |
|
83 | 87 | ```js |
84 | | -purge: { |
85 | | - content: [ |
86 | | - //...Rest of your paths |
87 | | - "./vendor/laravel-views/**/*.php", |
88 | | - ], |
89 | | -}, |
| 88 | +purge: [ |
| 89 | + //...Rest of your paths |
| 90 | + "./vendor/laravel-views/**/*.php", |
| 91 | +], |
90 | 92 | ``` |
91 | 93 |
|
92 | 94 | # First table view |
@@ -147,63 +149,11 @@ In the example above the view is using the User model created by default in ever |
147 | 149 | This is the basic usage of the table view, but you can customize it with more features. |
148 | 150 |
|
149 | 151 | [Read the full table view documentation ](doc/table-view.md) |
150 | | - |
151 | | -# Rendering a view from a controller |
152 | | - |
153 | | -You can render a view manually in a controller creating a `LaravelViews` instance and executing the `render` method on a `blade` file. |
154 | | - |
155 | | -```php |
156 | | -use use LaravelViews\LaravelViews; |
157 | | - |
158 | | -public function index(LaravelViews $laravelViews) |
159 | | -{ |
160 | | - $laravelViews->create(App\Http\Livewire\UsersTableView::class); |
161 | | - |
162 | | - return view('my-view', [ |
163 | | - 'view' => $laravelViews |
164 | | - ]); |
165 | | -} |
166 | | -``` |
167 | | -And render it in your blade file |
168 | | -```blade |
169 | | -{!! $view->render() !!} |
170 | | -``` |
171 | | - |
172 | | -## Specifying a layout and section |
173 | | -You can also return the view directly from your controller and specify the layout and section of your layout |
174 | | -```php |
175 | | -use use LaravelViews\LaravelViews; |
176 | | - |
177 | | -public function index(LaravelViews $laravelViews) |
178 | | -{ |
179 | | - $laravelViews->create(App\Http\Livewire\UsersTableView::class) |
180 | | - ->layout('layout', 'section-name'); |
181 | | - |
182 | | - return $laravelViews->render(); |
183 | | -} |
184 | | -``` |
185 | | - |
186 | | -## Send extra data to the layout |
187 | | -In the same way that you would send data to your views, you can send more data to the layout file |
188 | | -```php |
189 | | -use use LaravelViews\LaravelViews; |
190 | | - |
191 | | -public function index(LaravelViews $laravelViews) |
192 | | -{ |
193 | | - $laravelViews->create(App\Http\Livewire\UsersTableView::class) |
194 | | - ->layout('layout', 'section-name', [ |
195 | | - 'title' => 'My layout title' |
196 | | - ]); |
197 | | - |
198 | | - return $laravelViews->render(); |
199 | | -} |
200 | | -``` |
201 | | - |
202 | 152 | # Components customization |
203 | 153 | These views are build with [Tailwind CSS](https://tailwindcss.com/) and you can either change the colors of the components following tailwindcss utilities or fully customize all the html of the components |
204 | 154 |
|
205 | 155 | ## Component variants using tailwindcss |
206 | | -If you are using [Tailwind CSS](https://tailwindcss.com/) or if you don't have issues using Tailwindcss and your own css styles, you can customize some utilities to change the color for each variant of the components publishing a config file |
| 156 | +You can customize some of the components styles (like the color) for each one of the variants with a config file. |
207 | 157 |
|
208 | 158 | ```bash |
209 | 159 | php artisan vendor:publish --tag=config |
|
0 commit comments