Merge branch 'laravel-12' into 'LivewireViews'
# Conflicts: # resources/views/components/footer.blade.php # resources/views/components/layouts/app.blade.php # routes/web.php
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Color;
|
||||
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\title;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
use App\Models\Color;
|
||||
#[title('Colors')]
|
||||
class Index extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
|
||||
#[Validate('required')]
|
||||
public $hex = '';
|
||||
|
||||
public function create() {
|
||||
// Validate
|
||||
$this->validate();
|
||||
|
||||
// Create the color
|
||||
Color::create([
|
||||
$this->all()
|
||||
]);
|
||||
|
||||
// Clear the form
|
||||
$this->reset(['name', 'hex']);
|
||||
}
|
||||
|
||||
public function delete(Color $color) {
|
||||
@Auth::check();
|
||||
$color->delete();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.color.index', [
|
||||
'colors' => Color::paginate(10)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@ namespace App\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Manufacturer;
|
||||
use Livewire\Attributes\title;
|
||||
|
||||
#[title('Dashboard')]
|
||||
class Dashboard extends Component
|
||||
{
|
||||
public function render()
|
||||
|
||||
Reference in New Issue
Block a user