feat: anggota dapat menulis artikel dengan workflow approval sebelum diterbitkan
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\MyPosts;
|
||||
|
||||
use App\Filament\Resources\MyPosts\Pages\CreateMyPost;
|
||||
use App\Filament\Resources\MyPosts\Pages\EditMyPost;
|
||||
use App\Filament\Resources\MyPosts\Pages\ListMyPosts;
|
||||
use App\Models\Post;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class MyPostResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Post::class;
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-pencil-square';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Konten';
|
||||
protected static ?string $modelLabel = 'Artikel Saya';
|
||||
protected static ?string $slug = 'my-posts';
|
||||
|
||||
// Hanya tampilkan artikel milik user yang login
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()->where('author_id', auth()->id());
|
||||
}
|
||||
|
||||
public static function form(Schema $form): Schema
|
||||
{
|
||||
return \App\Filament\Resources\MyPosts\Schemas\MyPostForm::configure($form);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return \App\Filament\Resources\MyPosts\Tables\MyPostsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListMyPosts::route('/'),
|
||||
'create' => CreateMyPost::route('/create'),
|
||||
'edit' => EditMyPost::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user