Skip to content
This repository was archived by the owner on Sep 28, 2019. It is now read-only.

Commit 66e5a2c

Browse files
authored
Merge pull request #13 from avored/dev
merging dev to master
2 parents 4d28e1a + 3201d53 commit 66e5a2c

File tree

7 files changed

+51
-40
lines changed

7 files changed

+51
-40
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"barryvdh/laravel-dompdf": "0.8.*",
2727
"laravel/passport": "5.0.*",
2828
"stripe/stripe-php": "^6.3",
29-
"avored/framework": "~1.8"
29+
"avored/framework": "~1.9"
3030
},
3131
"autoload": {
3232
"classmap": [

resources/assets/components/forms/avored-form-input.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
}
5050
},
5151
methods:{
52-
onChange: function(){
52+
onChange: function(event){
5353
this.$emit('change', event.target.value, this.fieldName);
5454
5555
if( event.target.value != "") {

resources/assets/components/forms/avored-form-select.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
}
5656
},
5757
methods:{
58-
onChange: function(){
58+
onChange: function(event){
5959
this.$emit('change', event.target.value, this.fieldName);
6060
6161
if( event.target.value != "") {

resources/assets/components/forms/avored-form-textarea.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
}
4949
},
5050
methods:{
51-
onChange: function(){
51+
onChange: function(event){
5252
this.$emit('change', event.target.value, this.fieldName);
5353
5454
if( event.target.value != "") {

src/DataGrid/Category.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/DataGrid/CategoryDataGrid.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace AvoRed\Ecommerce\DataGrid;
4+
5+
use AvoRed\Framework\DataGrid\Facade as DataGrid;
6+
use AvoRed\Framework\DataGrid\Columns\TextColumn;
7+
8+
class CategoryDataGrid
9+
{
10+
public $dataGrid;
11+
12+
public function __construct($model)
13+
{
14+
$dataGrid = DataGrid::make('admin_category_controller');
15+
16+
$dataGrid->model($model)
17+
->column('name', function (TextColumn $column) {
18+
$column->identifier('name')
19+
->label('Name')
20+
->sortable(true)
21+
->canFilter(true);
22+
})
23+
->column('slug', function (TextColumn $column) {
24+
$column->identifier('slug')
25+
->label('Slug')
26+
->sortable(true)
27+
->canFilter(true);
28+
})
29+
->linkColumn('edit', [], function ($model) {
30+
return "<a href='" . route('admin.category.edit', $model->id) . "' >Edit</a>";
31+
})->linkColumn('destroy', [], function ($model) {
32+
return "<form id='admin-category-destroy-" . $model->id . "'
33+
method='POST'
34+
action='" . route('admin.category.destroy', $model->id) . "'>
35+
<input name='_method' type='hidden' value='DELETE' />
36+
" . csrf_field() . "
37+
<a href='#'
38+
onclick=\"jQuery('#admin-category-destroy-$model->id').submit()\"
39+
>Destroy</a>
40+
</form>";
41+
});
42+
43+
$this->dataGrid = $dataGrid;
44+
}
45+
}

src/Http/Controllers/CategoryController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace AvoRed\Ecommerce\Http\Controllers;
44

55
use AvoRed\Framework\Models\Database\Category as Model;
6-
use AvoRed\Ecommerce\DataGrid\Category;
76
use AvoRed\Ecommerce\Http\Requests\CategoryRequest;
87
use AvoRed\Framework\Models\Contracts\CategoryInterface;
8+
use AvoRed\Ecommerce\DataGrid\CategoryDataGrid;
99

1010
class CategoryController extends Controller
1111
{
@@ -27,7 +27,7 @@ public function __construct(CategoryInterface $repository)
2727
*/
2828
public function index()
2929
{
30-
$categoryGrid = new Category($this->repository->query());
30+
$categoryGrid = new CategoryDataGrid($this->repository->query());
3131

3232
return view('avored-ecommerce::category.index')->with('dataGrid', $categoryGrid->dataGrid);
3333
}

0 commit comments

Comments
 (0)