Skip to content

Commit

Permalink
Merge pull request #70 from Laravel-Backpack/laravel-11-support
Browse files Browse the repository at this point in the history
laravel 11
  • Loading branch information
pxpm authored Mar 13, 2024
2 parents e692b60 + 22fb29b commit 68fb93b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"require": {
"backpack/crud": "^6.0",
"backpack/pro": "^2.0",
"cviebrock/eloquent-sluggable": "^10.0"
"cviebrock/eloquent-sluggable": "^10.0|^11.0"
},
"require-dev": {
"phpunit/phpunit" : "^9.0||^7.0",
"phpunit/phpunit" : "^10.0||^9.0||^7.0",
"scrutinizer/ocular": "~1.1",
"squizlabs/php_codesniffer": "~2.3||~3.0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/app/Http/Controllers/Admin/ArticleCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function setup()
'name' => 'category_id',
'entity' => 'category',
'attribute' => 'name',
'wrapper' => [
'wrapper' => [
'href' => function ($crud, $column, $entry, $related_key) {
return backpack_url('category/'.$related_key.'/show');
},
Expand All @@ -63,7 +63,7 @@ public function setup()
$this->crud->addFilter([ // select2 filter
'name' => 'category_id',
'type' => 'select2',
'label'=> 'Category',
'label' => 'Category',
], function () {
return \Backpack\NewsCRUD\app\Models\Category::all()->keyBy('id')->pluck('name', 'id')->toArray();
}, function ($value) { // if the filter is active
Expand All @@ -73,7 +73,7 @@ public function setup()
$this->crud->addFilter([ // select2_multiple filter
'name' => 'tags',
'type' => 'select2_multiple',
'label'=> 'Tags',
'label' => 'Tags',
], function () {
return \Backpack\NewsCRUD\app\Models\Tag::all()->keyBy('id')->pluck('name', 'id')->toArray();
}, function ($values) { // if the filter is active
Expand Down
8 changes: 4 additions & 4 deletions src/app/Http/Controllers/Admin/CategoryCrudController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ protected function setupListOperation()
CRUD::addColumn('slug');
CRUD::addColumn('parent');
CRUD::addColumn([ // select_multiple: n-n relationship (with pivot table)
'label' => 'Articles', // Table column heading
'type' => 'relationship_count',
'name' => 'articles', // the method that defines the relationship in your Model
'wrapper' => [
'label' => 'Articles', // Table column heading
'type' => 'relationship_count',
'name' => 'articles', // the method that defines the relationship in your Model
'wrapper' => [
'href' => function ($crud, $column, $entry, $related_key) {
return backpack_url('article?category_id='.$entry->getKey());
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class Article extends Model
// protected $hidden = [];
// protected $dates = [];
protected $casts = [
'featured' => 'boolean',
'date' => 'date',
'featured' => 'boolean',
'date' => 'date',
];

/**
Expand Down

0 comments on commit 68fb93b

Please sign in to comment.