fix toggle formatting for wishlist
This commit is contained in:
@@ -45,7 +45,9 @@ class Portfolio extends Model
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $casts = [];
|
protected $casts = [
|
||||||
|
'wishlist' => 'boolean'
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The relationships that should always be eagerly loaded.
|
* The relationships that should always be eagerly loaded.
|
||||||
|
|||||||
@@ -19,12 +19,16 @@ new class extends Component {
|
|||||||
#[Rule('sometimes|nullable')]
|
#[Rule('sometimes|nullable')]
|
||||||
public ?string $notes;
|
public ?string $notes;
|
||||||
|
|
||||||
|
#[Rule('sometimes|boolean')]
|
||||||
|
public ?bool $wishlist;
|
||||||
|
|
||||||
public function mount() {
|
public function mount() {
|
||||||
|
|
||||||
if (isset($this->portfolio)) {
|
if (isset($this->portfolio)) {
|
||||||
|
|
||||||
$this->title = $this->portfolio->title;
|
$this->title = $this->portfolio->title;
|
||||||
$this->notes = $this->portfolio->notes;
|
$this->notes = $this->portfolio->notes;
|
||||||
|
$this->wishlist = $this->portfolio->wishlist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,14 +43,12 @@ new class extends Component {
|
|||||||
// $this->portfolio->owner_id = auth()->user()->id;
|
// $this->portfolio->owner_id = auth()->user()->id;
|
||||||
$this->portfolio->save();
|
$this->portfolio->save();
|
||||||
|
|
||||||
$this->success('Portfolio updated.', redirectTo: "/portfolio/{$this->portfolio->id}");
|
$this->success('Portfolio updated', redirectTo: "/portfolio/{$this->portfolio->id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save()
|
public function save()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // get stats
|
// // get stats
|
||||||
// $key = 'portfolio-metrics-' . $portfolio->id;
|
// $key = 'portfolio-metrics-' . $portfolio->id;
|
||||||
// $metrics = cache()->remember($key, 60, function () use ($portfolio) {
|
// $metrics = cache()->remember($key, 60, function () use ($portfolio) {
|
||||||
@@ -64,7 +66,7 @@ new class extends Component {
|
|||||||
// $portfolio->owner_id = auth()->user()->id;
|
// $portfolio->owner_id = auth()->user()->id;
|
||||||
$portfolio->save();
|
$portfolio->save();
|
||||||
|
|
||||||
$this->success('Portfolio created.', redirectTo: "/portfolio/{$portfolio->id}");
|
$this->success('Portfolio created', redirectTo: "/portfolio/{$portfolio->id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function with(): array
|
public function with(): array
|
||||||
@@ -81,7 +83,9 @@ new class extends Component {
|
|||||||
|
|
||||||
{{-- <x-select label="Category" wire:model="category_id" placeholder="Select a category" :options="$categories" /> --}}
|
{{-- <x-select label="Category" wire:model="category_id" placeholder="Select a category" :options="$categories" /> --}}
|
||||||
|
|
||||||
<x-textarea label="Body" wire:model="notes" rows="5" />
|
<x-textarea label="Notes" wire:model="notes" rows="5" />
|
||||||
|
|
||||||
|
<x-toggle label="Wishlist" wire:model="wishlist" />
|
||||||
|
|
||||||
<x-slot:actions>
|
<x-slot:actions>
|
||||||
@if (!$hideCancel)
|
@if (!$hideCancel)
|
||||||
|
|||||||
Reference in New Issue
Block a user