Linux sg77.dns-private.com 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
LiteSpeed
Server IP : 135.181.230.13 & Your IP : 216.73.216.199
Domains :
Cant Read [ /etc/named.conf ]
User : pilasate
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
pilasate /
schoolms /
app /
Filament /
Resources /
Delete
Unzip
Name
Size
Permission
Date
Action
AttendanceResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
CourseAssignmentResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
CourseEnrollmentResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
GradeResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
MarkResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
MessageResource
[ DIR ]
drwxr-xr-x
2025-03-27 22:56
PromotionResource
[ DIR ]
drwxrwxrwx
2025-03-24 00:50
ReportResource
[ DIR ]
drwxrwxrwx
2025-03-24 10:11
StudentResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
SubjectResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
TeacherResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
UserResource
[ DIR ]
drwxrwxrwx
2025-03-23 13:10
Widgets
[ DIR ]
drwxrwxrwx
2025-03-23 19:51
AttendanceResource.php
13.87
KB
-rw-rw-rw-
2025-03-24 07:12
CourseAssignmentResource.php
7.36
KB
-rw-rw-rw-
2025-03-27 22:46
CourseEnrollmentResource.php
15.35
KB
-rw-rw-rw-
2025-03-24 06:07
GradeResource.php
3.48
KB
-rw-rw-rw-
2025-03-24 06:33
MarkResource.php
17.63
KB
-rw-rw-rw-
2025-03-28 00:00
MessageResource.php
5.43
KB
-rw-r--r--
2025-03-28 00:04
PromotionResource.php
8.05
KB
-rw-rw-rw-
2025-03-24 03:04
StudentResource.php
5.58
KB
-rw-rw-rw-
2025-03-27 22:49
SubjectResource.php
2.81
KB
-rw-rw-rw-
2025-03-24 11:32
TeacherResource.php
3.92
KB
-rw-rw-rw-
2025-03-24 11:32
UserResource.php
4.91
KB
-rw-rw-rw-
2025-03-24 06:45
Save
Rename
<?php namespace App\Filament\Resources; use App\Filament\Resources\MessageResource\Pages; use App\Filament\Resources\MessageResource\RelationManagers; use App\Models\Message; use Filament\Forms; use Filament\Forms\Form; use Filament\Resources\Resource; use Filament\Tables; use Filament\Tables\Table; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Facades\Auth; class MessageResource extends Resource { protected static ?string $model = Message::class; protected static ?string $navigationIcon = 'heroicon-o-envelope'; protected static ?string $navigationGroup = 'Result Assessment'; protected static ?string $slug = 'messages'; // Ensure this matches your intended route public static function form(Form $form): Form { return $form ->schema([ Forms\Components\Select::make('grade_id') ->label('Grade') ->relationship('grade', 'name') ->visible(fn () => Auth::user()->hasRole('teacher')), Forms\Components\Select::make('subject_id') ->label('Subject') ->relationship('subject', 'name') ->visible(fn () => Auth::user()->hasRole('teacher')), Forms\Components\Select::make('student_id') ->label('Student') ->relationship('student', 'name') ->required(), Forms\Components\TextInput::make('mark') ->label('Total Mark') ->required(), Forms\Components\Textarea::make('remark') ->label('Remark') ->nullable(), ]); } public static function table(Table $table): Table { return $table ->query(function () { $user = Auth::user(); if ($user->hasRole('teacher')) { return Message::where('teacher_id', $user->id); } elseif ($user->hasRole('student')) { return Message::where('student_id', $user->id); } return Message::query(); }) ->columns([ Tables\Columns\TextColumn::make('grade.name')->label('Grade')->sortable(), Tables\Columns\TextColumn::make('subject.name')->label('Subject')->sortable(), Tables\Columns\TextColumn::make('teacher.name')->label('From Teacher')->sortable(), Tables\Columns\TextColumn::make('student.name')->label('To Student')->sortable(), Tables\Columns\TextColumn::make('mark')->label('Total Mark'), Tables\Columns\TextColumn::make('remark')->label('Remark'), Tables\Columns\TextColumn::make('created_at')->label('Sent At')->sortable(), ]) ->filters([ Tables\Filters\SelectFilter::make('student_id') ->relationship('student', 'name') ->label('Filter by Student'), Tables\Filters\SelectFilter::make('subject_id') ->relationship('subject', 'name') ->label('Filter by Subject'), ]) ->actions([ Tables\Actions\EditAction::make(), Tables\Actions\DeleteAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListMessages::route('/'), 'create' => Pages\CreateMessage::route('/create'), 'edit' => Pages\EditMessage::route('/{record}/edit'), ]; } public static function canViewAny(): bool { // Allow both teachers and admins to view marks return Auth::user()->hasAnyRole(['teacher', 'admin', 'student']); } public static function canCreate(): bool { // Allow both teachers and admins to create marks return Auth::user()->hasAnyRole(['teacher', 'admin']); } public static function canEdit($record): bool { $user = Auth::user(); // Allow admins to edit any record // Allow teachers to edit only their own records return $user->hasRole('admin') || ($user->hasRole('teacher') && $record->teacher_id === $user->id); } public static function canDelete($record): bool { $user = Auth::user(); // Allow admins to delete any record // Allow teachers to delete only their own records return $user->hasRole('admin') || ($user->hasRole('teacher') && $record->teacher_id === $user->id); } public static function getNavigationBadge(): ?string // array { $user = Auth::user(); if ($user->hasRole('teacher')) { return (string) Message::where('teacher_id', $user->id)->count(); } if ($user->hasRole('student')) { return (string) Message::where('student_id', $user->id)->count(); } return (string) Message::count(); } }