Implement creator studio and upload updates
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Http\Controllers\Studio;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\NovaCard;
|
||||
use App\Services\NovaCards\NovaCardPresenter;
|
||||
use App\Services\Studio\CreatorStudioContentService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Inertia\Inertia;
|
||||
@@ -16,36 +17,22 @@ class StudioNovaCardsController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly NovaCardPresenter $presenter,
|
||||
private readonly CreatorStudioContentService $content,
|
||||
) {
|
||||
}
|
||||
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$cards = NovaCard::query()
|
||||
->with(['category', 'template', 'backgroundImage', 'tags', 'user.profile'])
|
||||
->where('user_id', $request->user()->id)
|
||||
->latest('updated_at')
|
||||
->paginate(18)
|
||||
->withQueryString();
|
||||
|
||||
$baseQuery = NovaCard::query()->where('user_id', $request->user()->id);
|
||||
$provider = $this->content->provider('cards');
|
||||
$listing = $this->content->list($request->user(), $request->only(['q', 'sort', 'bucket', 'page', 'per_page']), null, 'cards');
|
||||
|
||||
return Inertia::render('Studio/StudioCardsIndex', [
|
||||
'cards' => $this->presenter->paginator($cards, false, $request->user()),
|
||||
'stats' => [
|
||||
'all' => (clone $baseQuery)->count(),
|
||||
'drafts' => (clone $baseQuery)->where('status', NovaCard::STATUS_DRAFT)->count(),
|
||||
'processing' => (clone $baseQuery)->where('status', NovaCard::STATUS_PROCESSING)->count(),
|
||||
'published' => (clone $baseQuery)->where('status', NovaCard::STATUS_PUBLISHED)->count(),
|
||||
],
|
||||
'editorOptions' => $this->presenter->options(),
|
||||
'endpoints' => [
|
||||
'create' => route('studio.cards.create'),
|
||||
'editPattern' => route('studio.cards.edit', ['id' => '__CARD__']),
|
||||
'previewPattern' => route('studio.cards.preview', ['id' => '__CARD__']),
|
||||
'analyticsPattern' => route('studio.cards.analytics', ['id' => '__CARD__']),
|
||||
'draftStore' => route('api.cards.drafts.store'),
|
||||
],
|
||||
'title' => 'Cards',
|
||||
'description' => 'Manage short-form Nova cards with the same shared filters, statuses, and actions used across Creator Studio.',
|
||||
'summary' => $provider?->summary($request->user()),
|
||||
'listing' => $listing,
|
||||
'quickCreate' => $this->content->quickCreate(),
|
||||
'publicBrowseUrl' => '/cards',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user