Skip to content

Commit d696bce

Browse files
update read me file and add doc folder
1 parent 18f2282 commit d696bce

File tree

7 files changed

+917
-3
lines changed

7 files changed

+917
-3
lines changed

README.md

Lines changed: 129 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,130 @@
1-
#laravel Data Table
1+
# Introduction
22

3-
this pcakge help to easy create datatable .
3+
<p align="center">
4+
<img src="art/intro-image.png" alt="laravel-vue-datatable intro image">
5+
</p>
6+
7+
**if you want to make dataTable easy and quickly with crazy features, this package is for you.**
8+
9+
These two Laravel packages are for making easy and quickly dataTable for your work, the goal is to make a table without taking care to code hard to create it, just with little steps, you can create it
10+
11+
## Table of contents
12+
13+
1. [Introduction](1-introduction.md)
14+
* [Quick Example](#Quick Example)
15+
2. [Installation and Setup](2-Installation-and-Setup.md)
16+
3. [Configuration](3-Configuration.md)
17+
4. [Usage](4-Usage.md)
18+
19+
20+
21+
22+
## Quick Example
23+
24+
### **Start create Grid Class**
25+
26+
```php
27+
// app/DataGrid/PostGrid.php
28+
29+
<?php
30+
31+
32+
namespace App\DataGrid;
33+
34+
use Yazan\DataTable\DataGrid;
35+
36+
class PostGrid extends DataGrid
37+
{
38+
39+
public $model = "App\Models\Post";
40+
41+
42+
}
43+
44+
```
45+
46+
### **Make an instance from PostGrid class and return the collection**
47+
48+
```php
49+
// app/Http/Controller/PostController.php
50+
51+
public function all(Request $request)
52+
{
53+
$posts = (new PostGrid())->render();
54+
55+
return ['success' => true, 'collection' => $posts];
56+
57+
}
58+
59+
```
60+
61+
### **use the data-table component in your blade**
62+
63+
```html
64+
// resources/posts/index.blade.php
65+
66+
<x-app-layout>
67+
68+
69+
70+
71+
<data-table
72+
:config="{
73+
url: `/{{app()->getLocale()}}/admin/posts/all?page=1`,
74+
},
75+
}"
76+
:columns="[
77+
{
78+
label: 'ID',
79+
column: 'id',
80+
show: true,
81+
sort:{
82+
sortable: false,
83+
sortColumn: 'id',
84+
85+
},
86+
87+
},
88+
{
89+
label: 'Title',
90+
column: 'title',
91+
show: true,
92+
sort:{
93+
sortable: true,
94+
sortColumn: 'title',
95+
sortDir: 'asc',
96+
},
97+
},
98+
{
99+
label: 'CreatedAt',
100+
column: 'created_at',
101+
show: true,
102+
sort:{
103+
sortable: true,
104+
sortColumn: 'created_at',
105+
sortDir: 'asc',
106+
},
107+
},
108+
{
109+
label: 'UpdatedAt',
110+
column: 'updated_at',
111+
show: true,
112+
sort:{
113+
sortable: true,
114+
sortColumn: 'updated_at',
115+
sortDir: 'asc',
116+
},
117+
},
118+
]
119+
"
120+
121+
></data-table>
122+
123+
124+
125+
126+
127+
</x-app-layout>
128+
}
129+
130+
```

_docs/1-introduction.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Introduction
2+
3+
<p align="center">
4+
<img src="art/intro-image.png" alt="laravel-vue-datatable intro image">
5+
</p>
6+
7+
**if you want to make dataTable easy and quickly with crazy features, this package is for you.**
8+
9+
These two Laravel packages are for making easy and quickly dataTable for your work, the goal is to make a table without taking care to code hard to create it, just with little steps, you can create it
10+
11+
## Table of contents
12+
13+
1. [Introduction](1-introduction.md)
14+
* [Quick Example](#Quick Example)
15+
2. [Installation and Setup](2-Installation-and-Setup.md)
16+
3. [Configuration](3-Configuration.md)
17+
4. [Usage](4-Usage.md)
18+
19+
20+
21+
22+
## Quick Example
23+
24+
### **Start create Grid Class**
25+
26+
```php
27+
// app/DataGrid/PostGrid.php
28+
29+
<?php
30+
31+
32+
namespace App\DataGrid;
33+
34+
use Yazan\DataTable\DataGrid;
35+
36+
class PostGrid extends DataGrid
37+
{
38+
39+
public $model = "App\Models\Post";
40+
41+
42+
}
43+
44+
```
45+
46+
### **Make an instance from PostGrid class and return the collection**
47+
48+
```php
49+
// app/Http/Controller/PostController.php
50+
51+
public function all(Request $request)
52+
{
53+
$posts = (new PostGrid())->render();
54+
55+
return ['success' => true, 'collection' => $posts];
56+
57+
}
58+
59+
```
60+
61+
### **use the data-table component in your blade**
62+
63+
```html
64+
// resources/posts/index.blade.php
65+
66+
<x-app-layout>
67+
68+
69+
70+
71+
<data-table
72+
:config="{
73+
url: `/{{app()->getLocale()}}/admin/posts/all?page=1`,
74+
},
75+
}"
76+
:columns="[
77+
{
78+
label: 'ID',
79+
column: 'id',
80+
show: true,
81+
sort:{
82+
sortable: false,
83+
sortColumn: 'id',
84+
85+
},
86+
87+
},
88+
{
89+
label: 'Title',
90+
column: 'title',
91+
show: true,
92+
sort:{
93+
sortable: true,
94+
sortColumn: 'title',
95+
sortDir: 'asc',
96+
},
97+
},
98+
{
99+
label: 'CreatedAt',
100+
column: 'created_at',
101+
show: true,
102+
sort:{
103+
sortable: true,
104+
sortColumn: 'created_at',
105+
sortDir: 'asc',
106+
},
107+
},
108+
{
109+
label: 'UpdatedAt',
110+
column: 'updated_at',
111+
show: true,
112+
sort:{
113+
sortable: true,
114+
sortColumn: 'updated_at',
115+
sortDir: 'asc',
116+
},
117+
},
118+
]
119+
"
120+
121+
></data-table>
122+
123+
124+
125+
126+
127+
</x-app-layout>
128+
}
129+
130+
```

_docs/2-Installation-and-Setup.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Table of contents
2+
3+
1. [Introduction](1-introduction.md)
4+
2. [Installation and Setup](2-Installation-and-Setup.md)
5+
3. [Configuration](3-Configuration.md)
6+
4. [Usage](4-Usage.md)
7+
8+
9+
10+
11+
## Installation
12+
13+
There is two-step to install packages
14+
15+
## server side
16+
17+
step 1
18+
```bash
19+
composer require yazan/laravel-datatable
20+
```
21+
step 2
22+
23+
create grid class
24+
```bash
25+
php artisan make:grid-class exampleGrid
26+
```
27+
28+
## clint side
29+
30+
step 1
31+
```bash
32+
npm i @yazan.alnughnugh/vue-datatable
33+
```
34+
step 2
35+
```javascript
36+
// app/resources/js/app.js
37+
38+
Vue.component('data-table', require('@yazan.alnughnugh/vue-datatable').default);
39+
```

0 commit comments

Comments
 (0)