-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '174-upgrade-to-Laravel-11'
- Loading branch information
Showing
53 changed files
with
3,521 additions
and
3,489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ _ide_helper.php | |
*.swp | ||
*.swo | ||
.phpunit.result.cache | ||
/tests/coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 11 additions & 11 deletions
22
app/Http/Livewire/Backend/Article/Index.php → app/Livewire/Backend/Article/Index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 12 additions & 10 deletions
22
app/Http/Livewire/Backend/Category/Index.php → app/Livewire/Backend/Category/Index.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Backend\Category; | ||
namespace App\Livewire\Backend\Category; | ||
|
||
use App\Models\Category; | ||
use Illuminate\Contracts\Pagination\LengthAwarePaginator; | ||
use Illuminate\Contracts\View\View; | ||
use Illuminate\Database\Eloquent\Relations\HasMany; | ||
use Illuminate\Support\Arr; | ||
use Livewire\Component; | ||
|
||
class Index extends Component | ||
{ | ||
public $adding = false; | ||
public bool $adding = false; | ||
|
||
public $category; | ||
public array $category = []; | ||
|
||
protected $listeners = ['categoryDeleted' => '$refresh']; | ||
|
||
public function render() | ||
public function render(): View | ||
{ | ||
$categories = $this->getCategories(); | ||
|
||
return view('livewire.backend.category.index', compact('categories')); | ||
} | ||
|
||
public function startAdding() | ||
public function startAdding(): void | ||
{ | ||
$this->adding = true; | ||
} | ||
|
||
public function store() | ||
public function store(): void | ||
{ | ||
$data = $this->validate(['category.name' => 'required', 'category.alias' => 'required']); | ||
|
||
Category::create(Arr::get($data, 'category')); | ||
Category::query()->create(Arr::get($data, 'category')); | ||
|
||
$this->adding = false; | ||
} | ||
|
||
protected function getCategories(): LengthAwarePaginator | ||
{ | ||
return Category::with(['articles' => function ($articles) { | ||
return $articles->notDeleted(); | ||
}])->orderBy('name') | ||
return Category::query() | ||
->with(['articles' => fn (HasMany $articles) => $articles->notDeleted()]) | ||
->orderBy('name') | ||
->paginate(); | ||
} | ||
} |
Oops, something went wrong.