aacarrion4
aacarrion4
FFilament
Created by aacarrion4 on 9/8/2024 in #❓┊help
Individual search fields
Thank you very much, Dennis!
5 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
I solved it, I did what you said, thank you very much for the help.
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
Yes, that's where I use it
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
Ahh ok, I use it in the save method for the save button.
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
And it is used to call the FormAcademicComponent.
public static function getPages(): array
{
return [
'index' => Pages\ListAcademicComponents::route('/'),
'createform' => Pages\FormAcademicComponent::route('/createform'),
'create' => Pages\CreateAcademicComponent::route('/create'),
//'edit' => Pages\EditAcademicComponent::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListAcademicComponents::route('/'),
'createform' => Pages\FormAcademicComponent::route('/createform'),
'create' => Pages\CreateAcademicComponent::route('/create'),
//'edit' => Pages\EditAcademicComponent::route('/{record}/edit'),
];
}
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
No description
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
Forgive my ignorance, but from the resource FormAcademicComponent I am calling a custom view (filament.resources.academic-component-resource.pages.form-academic-component) for a save button, the problem is that I don't know where to define this path.
public static function getPages(): array
{
return [
'index' => Pages\ListAcademicComponents::route('/'),
'createform' => Pages\FormAcademicComponent::route('/createform'),
'create' => Pages\CreateAcademicComponent::route('/create'),
//'edit' => Pages\EditAcademicComponent::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListAcademicComponents::route('/'),
'createform' => Pages\FormAcademicComponent::route('/createform'),
'create' => Pages\CreateAcademicComponent::route('/create'),
//'edit' => Pages\EditAcademicComponent::route('/{record}/edit'),
];
}
FormAcademicComponent
<?php

namespace App\Filament\Resources\AcademicComponentResource\Pages;

use App\Filament\Resources\AcademicComponentResource;
use App\Models\AcademicComponent;
use Filament\Resources\Pages\CreateRecord;

class FormAcademicComponent extends CreateRecord
{
protected static string $resource = AcademicComponentResource::class;


protected static string $view = 'filament.resources.academic-component-resource.pages.form-academic-component';

public function form(Form $form): Form
{
return $form->schema([]);
}

public function save()
{
return redirect()->to('dashboard/academic-components');
}
}
<?php

namespace App\Filament\Resources\AcademicComponentResource\Pages;

use App\Filament\Resources\AcademicComponentResource;
use App\Models\AcademicComponent;
use Filament\Resources\Pages\CreateRecord;

class FormAcademicComponent extends CreateRecord
{
protected static string $resource = AcademicComponentResource::class;


protected static string $view = 'filament.resources.academic-component-resource.pages.form-academic-component';

public function form(Form $form): Form
{
return $form->schema([]);
}

public function save()
{
return redirect()->to('dashboard/academic-components');
}
}
filament.resources.academic-component-resource.pages.form-academic-component:
<x-filament-panels::page>
<form method="post" wire:submit="save">
{{ $this->form }}
<button type="submit" class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Guardar
</button>
<button onclick="window.location.href='{{ url()->previous() }}';"
class="mt-4 px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600">
Cancelar
</button>
</form>
</x-filament-panels::page>
<x-filament-panels::page>
<form method="post" wire:submit="save">
{{ $this->form }}
<button type="submit" class="mt-4 px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600">
Guardar
</button>
<button onclick="window.location.href='{{ url()->previous() }}';"
class="mt-4 px-4 py-2 bg-red-500 text-white rounded hover:bg-red-600">
Cancelar
</button>
</form>
</x-filament-panels::page>
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
Excuse me, where should I place this code?
22 replies
FFilament
Created by aacarrion4 on 7/7/2024 in #❓┊help
Custom button for a form
Yes, the problem is that I define the path in web for the redirection to work.
<?php
use App\Filament\Resources\AcademicComponentResource\Pages\FormAcademicComponent;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ReportGradeController;


Route::get('/form-academic-component', FormAcademicComponent::class)->name('form.academic.component');`
<?php
use App\Filament\Resources\AcademicComponentResource\Pages\FormAcademicComponent;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\ReportGradeController;


Route::get('/form-academic-component', FormAcademicComponent::class)->name('form.academic.component');`
22 replies
FFilament
Created by aacarrion4 on 6/9/2024 in #❓┊help
Repeater pointing to the same table
No description
2 replies
FFilament
Created by aacarrion4 on 6/8/2024 in #❓┊help
Hide all records in the table
No description
14 replies
FFilament
Created by aacarrion4 on 6/8/2024 in #❓┊help
Hide all records in the table
That is to say, I don't want all the records of the table to appear, only the filtered ones, otherwise it will be too confusing.
14 replies
FFilament
Created by aacarrion4 on 6/8/2024 in #❓┊help
Hide all records in the table
I understand, but for this table I needed it that way, since I don't want all the records to be mixed up.
14 replies
FFilament
Created by aacarrion4 on 6/8/2024 in #❓┊help
Hide all records in the table
Thank you very much, I have modified it a little and it worked.
->modifyQueryUsing(fn ($query, $livewire) => $query
->when(
blank($livewire->tableFilters),
fn ($query) => $query->whereRaw('1 <> 1')
)
->when(
$livewire->tableFilters['academic_period_id'] ?? null,
fn ($query, $academic_period_id) => $query->where('academic_period_id', $academic_period_id)
)
->when(
$livewire->tableFilters['course_id'] ?? null,
fn ($query, $course_id) => $query->where('course_id', $course_id)
))
->modifyQueryUsing(fn ($query, $livewire) => $query
->when(
blank($livewire->tableFilters),
fn ($query) => $query->whereRaw('1 <> 1')
)
->when(
$livewire->tableFilters['academic_period_id'] ?? null,
fn ($query, $academic_period_id) => $query->where('academic_period_id', $academic_period_id)
)
->when(
$livewire->tableFilters['course_id'] ?? null,
fn ($query, $course_id) => $query->where('course_id', $course_id)
))
14 replies
FFilament
Created by aacarrion4 on 6/8/2024 in #❓┊help
Hide all records in the table
Sorry, where should this code go?
14 replies
FFilament
Created by aacarrion4 on 6/2/2024 in #❓┊help
Hide field in form
But, I don't want it to be displayed on the form. I want the user to be created automatically with the student role.
11 replies
FFilament
Created by aacarrion4 on 6/2/2024 in #❓┊help
Hide field in form
Yes, I just want the default Student role to be saved.
11 replies
FFilament
Created by aacarrion4 on 6/2/2024 in #❓┊help
Hide field in form
No description
11 replies
FFilament
Created by aacarrion4 on 6/2/2024 in #❓┊help
Hide field in form
Do you have any other ideas?
11 replies
FFilament
Created by aacarrion4 on 6/2/2024 in #❓┊help
Hide field in form
Sorry, I can't find a way to hide it, I checked the documentation, but I didn't succeed.
11 replies