You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[See live example](http://laravel-views.herokuapp.com)
4
+
3
5
Laravel package to create beautiful common views like tables using only PHP code, inspired by [Laravel Nova](https://nova.laravel.com/), these views are built with [Laravel Livewire](https://laravel-livewire.com/) and styled using [Tailwind CSS](https://tailwindcss.com/)
4
6
5
7
## Table View example
@@ -8,20 +10,16 @@ Laravel package to create beautiful common views like tables using only PHP code
8
10
9
11
-[Version compatibility](#version-compatibility)
10
12
-[Installation and basic usage](#installation-and-basic-usage)
If you are updating this package you might need to republish these assets.
51
-
52
44
## Including assets
53
45
Add the following Blade directives in the *head* tag, and before the end *body* tag in your template
54
46
@@ -65,10 +57,11 @@ Add the following Blade directives in the *head* tag, and before the end *body*
65
57
</html>
66
58
```
67
59
68
-
These blade directives are also including [Laravel livewire](https://laravel-livewire.com/) styles and scripts, after that you may need to clear the view cache
60
+
These blade directives are also including [Laravel livewire](https://laravel-livewire.com/)and [Tailwindcss](https://tailwindcss.com/)styles and scripts, after that you may need to clear the view cache
69
61
```bash
70
62
php artisan view:clear
71
63
```
64
+
If you are already using your own Tailwindcss setup you can set `laravel-views` to not importing Tailwindcss by default. ([Importing assets](./doc/laravel-views#including-assets))
72
65
73
66
# First table view
74
67
This is a basic usage of a table view, you can [read the full table view documentation ](doc/table-view.md)
@@ -78,7 +71,7 @@ Once you have installed the package and included the assets you can start to cre
78
71
```bash
79
72
php artisan make:table-view UsersTableView
80
73
```
81
-
With this artisan command a UsersTableView.php file will be created inside `app/Http/Livewire` directory.
74
+
With this artisan command a UsersTableView.php file will be created inside the `app/Http/Livewire` directory.
82
75
83
76
The basic usage needs a data repository (Eloquent query), headers and rows, you can customize the items to be shown, and the headers and data for each row like this example
84
77
```php
@@ -99,20 +92,36 @@ class UsersTableView extends TableView
The easiest way to render the view is using the facade directly with a blade file
116
+
You can render this view in the same way as you would do it for a livewire component ([Rendering components](https://laravel-livewire.com/docs/2.x/rendering-components)).
117
+
The easiest way to render the view is using the livewire tag syntax:
You could also use the `@livewire` blade directive.
123
+
```blade
124
+
@livewire('users-table-view')
116
125
```
117
126
118
127
At this point, you would be able to see a table with some data, the table view doesn't have any styled container or title as the image example, you can render the table view inside any container you want.
@@ -123,89 +132,22 @@ This is the basic usage of the table view, but you can customize it with more fe
123
132
124
133
[Read the full table view documentation ](doc/table-view.md)
125
134
126
-
#Rendering a view
135
+
## Advanced usage
127
136
128
-
## From a controller
137
+
[Read the advanced laravel-views documentation ](doc/laravel-views.md)
129
138
130
-
The easiest way to render a view is using the facade directly on the blade file as the example above,
131
-
but it is a better practice if you inject a `LaravelViews` instance as a dependency in your controller.
139
+
## Views available
140
+
### [Table view](doc/table-view.md)
132
141
133
-
```php
134
-
use use LaravelViews\LaravelViews;
142
+
Dynamic data table with some features like filters, pagination and search input, you can customize the headers, the data to be displayed for each row
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
182
-
183
-
## Component variants using tailwindcss
184
-
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
Inside this config file you can change the colors for each component variant. If you are updating this package you might need to republish this config file.
195
-
196
-
## Components full customization
197
-
198
-
If you are not using taildwindcss, or if you want to have a full customization over the html components, you can publish all the blade files used for these views.
Dynamic grid view using card data, same as a TableView this view has features like filters, pagination and a search input, you can also customize the card data as you need
207
149
208
-
If you are updating this package you might need to republish these views.
150
+

209
151
210
152
## Contributing
211
153
@@ -217,10 +159,11 @@ Laravel Views is still under heavy development so I will be adding more awesome
217
159
218
160
Here's the plan for what's coming:
219
161
220
-
-*New grid view* to display data as a grid instead of as a table
0 commit comments