HeartlandTechie
Attaching additional information to a RelationManager?
When I add a RelationManager I want it to ask for or populate the year from a drop down - how can I add that in?
Tables\Actions\AttachAction::make()
->preloadRecordSelect()
->recordTitle(fn (Model $record): string => "{$record->student_number} - {$record->first_name} {$record->last_name} {$record->grade_level} {$record->school->name}")
->recordSelect(
fn (Select $select) => $select->placeholder('Student number or name'))
->form(fn (AttachAction $action): array => [
$action->getRecordSelect(),
])
->recordSelectOptionsQuery(fn (Builder $query): Builder => $query->where('grade_level', '>',8)->orderBy('last_name'))
->recordSelectSearchColumns(['student_number','first_name','last_name']),
4 replies
RelationManager - how to control what columns display back?
How can the search functionality display additional information? When I'm searching I am searching across both a name and a number, but just the number (which is what is going to be associated) is shown. I would like it to show both - like an employee number and first/last name.
5 replies
ExportColumn date format
Is there a way to fix a date format into a specific format - like m/d/y H:i when exporting? I have reports that show the date in one way but then when they export the end user is getting 24 hour military times . . . I need an easy button for them.
5 replies
Page title changes with Wizard?
I'm trying to make a page title the name of an entity and it works fine when the page loads. When I use the Wizard to advance to the next step, my page heading disappears. Any thoughts or insight?
web.php
Route::get('/checkin/check-in/{id}', \App\Filament\Checkin\Pages\CheckIn::class);
checkin.php
CheckIn extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected ?string $heading = '';
//protected ?string $subheading = '';
protected static string $view = 'filament.checkin.pages.check-in';
public ?string $student_number = '';
public ?string $status = '';
public ?string $out_reason = '';
public ?string $in_reason = '';
public ?string $info;
public function mount($id)
{
$this->info = $id;
$this->heading = \App\Models\School::where('school_number', $id)->value('name');
}
1 replies
Can I just upload images without the Spatie MediaPro library?
It looks like I should be able to add a page (not a resource) and build a form on that page and use the official Spatie Media Plugin for FilamentPHP to upload pics . . . they are being stored in the temp table, but I can't get them to be acknowledged in my page??
public function create(): void
{
$this->data = $this->form->getState('data');
$this->data['employee_id'] = auth()->user()->employeeid;
$this->data['school_number'] = $this->schoolid;
$this->data['dcid'] = $this->dcid;
$this->data['student_first_name'] = $this->student_first_name;
$this->data['student_last_name'] = $this->student_last_name;
$this->data['grade_level'] = $this->grade_level;
$this->data['year'] = '2023-2024';
$device = CollectedDevice::updateOrCreate(['student_number' => $this->student_number,'year'=> $this->data['year']],$this->data);
//$device = CollectedDevice::create($this->form->getState('data'));
// This barfs because I dont' have the pro license
// $device->addFromMediaLibraryRequest($this->photos)->toMediaCollection('images');
foreach($this->photos as $photo)
{
$device->addMedia($photo->livewire-file)->toMediaCollection('images');
}
$this->form->model($device)->saveRelationships();
3 replies
Person to address - how to keep the address as unique?
I have a table with people and an address can be added, that part I have working. What I want it to do is when you add the address I want it to give you the ability to search and find an address and associate it to the persion. (Think family units - father/mother and then children - we don't want four addresses, we want one address and then each of the parents/children can be associated to that one address.). Is there a handy way to do this ?
6 replies
Odd - create command putting file in wrong directory?
php artisan make:livewire CreatePost
COMPONENT CREATED 🤙
CLASS: app/CreatePost.php
VIEW: resources/views/livewire/create-post.blade.php
This is happening locally and on my development server. Any thoughts on why it would create in app directory vs. livewire?
5 replies
Route that displays a page with form?
How can I add a route that just displays a form - I think I'm very confused and doing this backwards. In fact one of my forms shows the form at the top and the HTML for the page at the bottom . . .it renders, but not well. Thoughts?
Route::get('/app_form', function () { return view('application_form'); })->name('business.send');
Route::get('/app_form', function () { return view('application_form'); })->name('business.send');
3 replies
Json OrWhere with other Filters ?
Suggestions on how to perform a subquery with a json field for multiple responses? I'm currently running into something like this:
Company table - json field with attributes for type of activities a business is interested in.
I want to be able to select something - like say a region where a company is as a filter (which works) but then say interested in team building, or direct sales, or whatever . . . but I want the businesses that have team building and I want the ones that have said direct sales. My filter should be an orwhere but it's against the json field.
6 replies