A lot of things
This commit is contained in:
@@ -19,7 +19,8 @@ class CategorySelector extends Component
|
||||
public function __construct(
|
||||
public string $section,
|
||||
public array $selected = [],
|
||||
public bool $required = true
|
||||
public bool $required = true,
|
||||
public bool $news = false
|
||||
)
|
||||
{
|
||||
$this->categories = Category::query()
|
||||
@@ -36,6 +37,6 @@ class CategorySelector extends Component
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.category-selector');
|
||||
return $this->news === true ? view('components.news-category-selector' ) : view('components.category-selector');
|
||||
}
|
||||
}
|
||||
|
||||
31
app/View/Components/NewsCard.php
Normal file
31
app/View/Components/NewsCard.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\News;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class NewsCard extends Component
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public News $news
|
||||
)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.news-card');
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\View\Components;
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\News;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
@@ -16,11 +17,16 @@ class SubmitEntryStatus extends Component
|
||||
public string $section,
|
||||
public bool $isEdit,
|
||||
public ?string $currentState,
|
||||
public null|string|Entry $entry = 'App\Models\Entry',
|
||||
public null|string|Entry|News $entry = null,
|
||||
public bool $news = false
|
||||
)
|
||||
{
|
||||
if( $this->entry === null )
|
||||
$this->entry = 'App\Models\Entry';
|
||||
if( $this->entry === null ){
|
||||
if( $news )
|
||||
$this->entry = 'App\Models\News';
|
||||
else
|
||||
$this->entry = 'App\Models\Entry';
|
||||
}
|
||||
}
|
||||
|
||||
public function availableStates(): array
|
||||
|
||||
Reference in New Issue
Block a user