cms/app/Http/Controllers/Admin/Posts/PostCreateController.php

42 lines
1.4 KiB
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Controllers\Admin\Posts;
use App\Http\Controllers\Controller;
use App\Models\CustomPostType;
use App\Models\Post;
use App\Services\AccessibilityAnalyzer;
use App\Services\SettingService;
use Illuminate\Support\Facades\Gate;
use Illuminate\View\View;
/**
* Controller for showing the post creation UI.
*/
class PostCreateController extends Controller
{
/**
* Show the form for creating a new post.
*
* @param \App\Models\CustomPostType $customPostType
* @param \App\Services\AccessibilityAnalyzer $analyzer
* @param \App\Services\SettingService $settingService
* @return \Illuminate\View\View
*/
public function __invoke(CustomPostType $customPostType, AccessibilityAnalyzer $analyzer, SettingService $settingService): View
{
return view('admin.posts.editor', [
'customPostType' => $customPostType->load('fields'),
'a11yIssues' => $analyzer->analyze([]),
'availableLocales' => $settingService->getSupportedLocales(),
'defaultLocale' => $settingService->get('default_locale', config('app.locale')),
'permissions' => [
'view-media' => Gate::allows('view-media'),
'upload-media' => Gate::allows('upload-media'),
'update-media' => Gate::allows('update-media'),
'delete-media' => Gate::allows('delete-media'),
],
]);
}
}