cms/app/Http/Controllers/Admin/Posts/PostIndexController.php
Funky Waddle 37ed997989 feat(cms): initialize Laravel project structure and core CMS files
- Added standard Laravel directory structure and configuration.

- Included Svelte and Tailwind configuration for the admin interface.

- Added core PHPUnit and testing scripts.
2026-04-13 12:48:06 -05:00

29 lines
734 B
PHP

<?php
namespace App\Http\Controllers\Admin\Posts;
use App\Http\Controllers\Controller;
use App\Models\CustomPostType;
use App\Models\Post;
use Illuminate\View\View;
/**
* Controller for listing posts for a specific CPT.
*/
class PostIndexController extends Controller
{
/**
* Display a listing of posts for a specific CPT.
*
* @param \App\Models\CustomPostType $customPostType
* @return \Illuminate\View\View
*/
public function __invoke(CustomPostType $customPostType): View
{
return view('admin.posts.index', [
'customPostType' => $customPostType,
'posts' => Post::where('custom_post_type_id', $customPostType->id)->with('author')->get(),
]);
}
}