Neamix
Neamix
Explore posts from servers
FFilament
Created by Neamix on 11/4/2024 in #❓┊help
Dynamic Filter
I want to create dynamic filter like step filter example i have table pet and each pet have type and each type contain a group of species so what i want to do here to allow user to choose the type first then the species appear to him i tried that concept
->filters([
SelectFilter::make('pet_type_id')
->label('نوع الحيوان')
->query(fn($data) => Session::put('pet.pet_type_id',$data['value'] ?? null))
->options(PetType::pluck('name_ar','id')->toArray()),

SelectFilter::make('pet_specie_id')
->options(function() {
$selectedPetType = Session::get('pet.pet_type_id');
dump($selectedPetType);
if ($selectedPetType)
return PetSpecie::where('pet_type_id',$selectedPetType)->pluck('specie_ar','id')->toArray();
else
return PetSpecie::pluck('specie_ar','id')->toArray();
})
->label('فصيلة الحيوان'),

SelectFilter::make('pet_color_id')
->label('لون الحيوان')
->options(PetColor::pluck('color_ar', 'id')->toArray()),
])
->filters([
SelectFilter::make('pet_type_id')
->label('نوع الحيوان')
->query(fn($data) => Session::put('pet.pet_type_id',$data['value'] ?? null))
->options(PetType::pluck('name_ar','id')->toArray()),

SelectFilter::make('pet_specie_id')
->options(function() {
$selectedPetType = Session::get('pet.pet_type_id');
dump($selectedPetType);
if ($selectedPetType)
return PetSpecie::where('pet_type_id',$selectedPetType)->pluck('specie_ar','id')->toArray();
else
return PetSpecie::pluck('specie_ar','id')->toArray();
})
->label('فصيلة الحيوان'),

SelectFilter::make('pet_color_id')
->label('لون الحيوان')
->options(PetColor::pluck('color_ar', 'id')->toArray()),
])
the only reason that i used query() because it was the only thing that worked as a callback function and this approche worked but the problem is that he get the prev type as example if i have type 0 default ,1 ,2 if i changed type from 0 to 1 it will show species of 0 if i changed 1 to 2 it will show species of 1 and so one
3 replies
FFilament
Created by Neamix on 11/4/2024 in #❓┊help
Call a function after change SelectFilter
In filters i want to call function after change the select filter as example
SelectFilter::make('myfilter')
->onChange(fn() => myCallBackFunction())
SelectFilter::make('myfilter')
->onChange(fn() => myCallBackFunction())
3 replies
FFilament
Created by Neamix on 10/12/2024 in #❓┊help
PanalsRenderHook doesnt acce[t @script tag
I have created panals render hook in the header but when i want to implement js i get this error
Using $this when not in object context
Using $this when not in object context
my component register in appservice provider
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
function () {
if (Auth::user()->role_id == DOCTOR)
return (new MessageCenter)->render();
},
);
FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
function () {
if (Auth::user()->role_id == DOCTOR)
return (new MessageCenter)->render();
},
);
my blade
<div>
@script
<script>
channel = window.pusher.subscribe('private-messagecenter.{{Auth::guard("admin")->user()->id}}');
channel.bind('MessageSent', function(data) {
Livewire.dispatch('MessegeReceive')
});
</script>
@endscript
</div>
<div>
@script
<script>
channel = window.pusher.subscribe('private-messagecenter.{{Auth::guard("admin")->user()->id}}');
channel.bind('MessageSent', function(data) {
Livewire.dispatch('MessegeReceive')
});
</script>
@endscript
</div>
13 replies
FFilament
Created by Neamix on 10/6/2024 in #❓┊help
Notification broadcast
i read the filament notification broadcast https://filamentphp.com/docs/3.x/notifications/broadcast-notifications i installed pusher successfully but the main problem that i cant find any channel occupied so do i have to do it manualy and if yes how to make filament refresh the notification when it receive a one
3 replies
FFilament
Created by Neamix on 9/30/2024 in #❓┊help
PanelsRenderHook not found
I am trying to customize body start of filament so i used panal render hook here is my code
use Filament\View\PanelsRenderHook;

FilamentView::registerRenderHook(
PanelsRenderHook::BODY_START,
fn (): View => view('impersonation-banner'),
);
use Filament\View\PanelsRenderHook;

FilamentView::registerRenderHook(
PanelsRenderHook::BODY_START,
fn (): View => view('impersonation-banner'),
);
but i am getting this error
Class "Filament\View\PanelsRenderHook" not found
Class "Filament\View\PanelsRenderHook" not found
4 replies
FFilament
Created by Neamix on 9/28/2024 in #❓┊help
Resource live update
How can i update a resource using pusher i mean when the user get pusher notification i want to update resource called reservation resource
3 replies
FFilament
Created by Neamix on 9/28/2024 in #❓┊help
Select default value from select dropdown
I want to set to set default value that i need it to be selected when the form render i tried this
Select::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft'),
Select::make('status')
->options([
'draft' => 'Draft',
'reviewing' => 'Reviewing',
'published' => 'Published',
])
->default('draft'),
but not working
7 replies
FFilament
Created by Neamix on 9/27/2024 in #❓┊help
Filepound stop working
I have filepound on a custom page this page is a chatroom so the user can send image by using filepound the main problem that when the user click on send btn its update the database as excepected but filepound stop working and i guess the probelm is when the filement update the blade it doesnt re run the scripts so anyone now how to handle that




2 replies
FFilament
Created by Neamix on 9/24/2024 in #❓┊help
Add script to a page
How can i added script to a certain page i dont want to add it globally only a script for one page
4 replies
FFilament
Created by Neamix on 9/15/2024 in #❓┊help
Add submit button to filament form in custom page
I have custom page called chat inside it i added filament form
{
use InteractsWithForms;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.chatroom-page';
protected static ?string $slug = 'room/{id}';
protected static string $label = '';
protected static ?string $title = '';
protected static ?int $id = null;
protected static $reservation = 12;
protected $data = [];

public static function shouldRegisterNavigation(): bool
{
return false;
}

public function mount()
{
$chatroom = Chatroom::find(request()->id);
self::$reservation = $chatroom->reservation;
}

public function form(Form $form): Form
{
return $form
->schema([
RichEditor::make('content')
->label('')
->required()
]);
}
}
{
use InteractsWithForms;

protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.chatroom-page';
protected static ?string $slug = 'room/{id}';
protected static string $label = '';
protected static ?string $title = '';
protected static ?int $id = null;
protected static $reservation = 12;
protected $data = [];

public static function shouldRegisterNavigation(): bool
{
return false;
}

public function mount()
{
$chatroom = Chatroom::find(request()->id);
self::$reservation = $chatroom->reservation;
}

public function form(Form $form): Form
{
return $form
->schema([
RichEditor::make('content')
->label('')
->required()
]);
}
}
the blade
<x-filament-panels::page>

<div class="form">
<form wire:submit.prevent="submitForm">
{{ $this->form }}

<x-filament::button type="submit" class="mt-6">
Send comment
</x-filament::button>
</form>
</div>
</x-filament-panels::page>
<x-filament-panels::page>

<div class="form">
<form wire:submit.prevent="submitForm">
{{ $this->form }}

<x-filament::button type="submit" class="mt-6">
Send comment
</x-filament::button>
</form>
</div>
</x-filament-panels::page>
i want to add submit button to the form where on click the form will validate then insert it to message table, i tried to search in filament form docs but i cant find any clue
3 replies
FFilament
Created by Neamix on 9/14/2024 in #❓┊help
Pass params to a custom page
How can i create route as example chatroom/{room_id} and pass this room id to custom filament page
12 replies
FFilament
Created by Neamix on 9/7/2024 in #❓┊help
Filament Page
Hey guys, I am still new to filament and i have a quick question after read the filament page documentation https://filamentphp.com/docs/2.x/admin/pages/actions i only find an explaination on how to use filament page functions but i didn't find how can i can view this functions as example
protected function getActions(): array
{
return [
Action::make('settings')->color('secondary'),
];
}
protected function getActions(): array
{
return [
Action::make('settings')->color('secondary'),
];
}
this function should as far as know display a button called settings but after i use it directly in filament class nothing appeared so i found that i need to call actions in blade but i cant find any docs on how to do that so anyone have any idea where i can find this infos
19 replies
FFilament
Created by Neamix on 8/26/2024 in #❓┊help
Filament Modal
I have a custom page contain button on click on that button i want modal to open i tried to use emit but it doesnt work my blade code
<x-filament-panels::page>
<div>
<x-filament::button wire:click="openModal">
Invite a member
</x-filament::button>

<x-filament::modal wire:model="isModalOpen" class="w-100">
<x-slot name="trigger">
<!-- Trigger content if needed -->
</x-slot>

<x-slot name="heading">
<div class="flex justify-between">
<h3>Invite a new member</h3>
</div>
</x-slot>

<div class="w-100">
{{ $this->form }}
</div>

<x-slot name="footer">
<x-filament::button wire:click="submit">
Invite
</x-filament::button>

<x-filament::button color="danger" x-on:click="closeModal">
Close
</x-filament::button>
</x-slot>
</x-filament::modal>
</div>
</x-filament-panels::page>
<x-filament-panels::page>
<div>
<x-filament::button wire:click="openModal">
Invite a member
</x-filament::button>

<x-filament::modal wire:model="isModalOpen" class="w-100">
<x-slot name="trigger">
<!-- Trigger content if needed -->
</x-slot>

<x-slot name="heading">
<div class="flex justify-between">
<h3>Invite a new member</h3>
</div>
</x-slot>

<div class="w-100">
{{ $this->form }}
</div>

<x-slot name="footer">
<x-filament::button wire:click="submit">
Invite
</x-filament::button>

<x-filament::button color="danger" x-on:click="closeModal">
Close
</x-filament::button>
</x-slot>
</x-filament::modal>
</div>
</x-filament-panels::page>
my .php file ``` <?php namespace App\Filament\Pages; use Filament\Pages\Page; use Filament\Forms; use Filament\Forms\Components\TextInput; use Filament\Notifications\Notification; use Filament\Actions\Action; class Members extends Page { protected static ?string $navigationIcon = 'heroicon-o-document-text'; protected static string $view = 'filament.pages.members'; protected static ?string $navigationLabel = "members"; protected static ?string $title = "members"; protected ?string $heading = ""; public $showInvitationModal = true; public function openModal() { $this->showInvitationModal = true; } public function closeModal() { $this->showInvitationModal = false; } }
6 replies
FFilament
Created by Neamix on 8/25/2024 in #❓┊help
Customize filament blade
Hi guys, how can i re customize some html of the filament dashboard
3 replies
FFilament
Created by Neamix on 8/21/2024 in #❓┊help
Add style sheet
How can i add a custom style sheet to my filament project
4 replies
FFilament
Created by Neamix on 8/18/2024 in #❓┊help
How to add a grid for widgets in dashboard
Hello everyone i have multi widgets on dashboard i want to add a grid for them like in the first row i need 2 widget and in the second i need 3 and so on
2 replies
FFilament
Created by Neamix on 8/17/2024 in #❓┊help
RTL
Can i make filament direction rtl instead of ltr
5 replies
FFilament
Created by Neamix on 8/17/2024 in #❓┊help
Customize Reset password page
How can i re customize forget password and reset password page
3 replies
FFilament
Created by Neamix on 7/1/2024 in #❓┊help
Google analytic installation
Hi Guys, I need to integrate with google analytic so i used that package "https://filamentphp.com/plugins/bezhansalleh-google-analytics" but i am keep getting that error
Call to undefined function BezhanSalleh\FilamentGoogleAnalytics\gmp_sign()
Call to undefined function BezhanSalleh\FilamentGoogleAnalytics\gmp_sign()
do anyone know how to solve that issue
3 replies
FFilament
Created by Neamix on 7/1/2024 in #❓┊help
Class "Filament\View\PanelsRenderHook" not found
Hello, I am getting that error each time i try to install any package
Class "Filament\View\PanelsRenderHook" not found
Class "Filament\View\PanelsRenderHook" not found
4 replies