mcdc
mcdc
FFilament
Created by mcdc on 4/25/2023 in #❓┊help
Restrict user to view certain Navigation Group
Thanks I just discover, by using https://github.com/bezhanSalleh/filament-shield I can just use, to restrict or redirect user without type super_admin
use HasPageShield;

protected function getShieldRedirectPath(): string {
return '/'; // redirect to the root index...
}
use HasPageShield;

protected function getShieldRedirectPath(): string {
return '/'; // redirect to the root index...
}
11 replies
FFilament
Created by mcdc on 4/25/2023 in #❓┊help
Restrict user to view certain Navigation Group
Thanks, can you redirect me to the documentation, I dont know how to start. I do have this RolePolicy by Shield Roles
11 replies
FFilament
Created by mcdc on 4/25/2023 in #❓┊help
Restrict user to view certain Navigation Group
So i want to hide this NavigationGroup::make('Admin') to regular user
11 replies
FFilament
Created by mcdc on 4/25/2023 in #❓┊help
Restrict user to view certain Navigation Group
I mean if the user has a type of "admin" i wan to show all navigation group, but if user has type of regular or just user i want to hide certain navigation group
11 replies
FFilament
Created by Bryan on 4/19/2023 in #❓┊help
Graphs
I wonder if there is something like that? Chart Inside modal (in filament)
6 replies
FFilament
Created by Messenger of truth on 4/18/2023 in #❓┊help
Form in customize page
by simple running this command php artisan make:filament-page NameOfYourPage --resource=UserResource you will be able to get a page, or you can remove --resource=UserResource if you dont want to include it.
4 replies
FFilament
Created by _andypeacock on 4/17/2023 in #❓┊help
Any way to get record in searchable()
Have you tried something like this ?
->searchable(function ($query, $search) {
$query->where('customer_name', 'like', "%{$search}%")
->orWhere('customer_email', 'like', "%{$search}%");
});
->searchable(function ($query, $search) {
$query->where('customer_name', 'like', "%{$search}%")
->orWhere('customer_email', 'like', "%{$search}%");
});
4 replies
FFilament
Created by gizmojo on 4/17/2023 in #❓┊help
Access table filter in togglable
Have you tried
->livewire(function () {
$component = app()->make(ListRecords::class);
$component->applyFilters();
return $component;
});
->livewire(function () {
$component = app()->make(ListRecords::class);
$component->applyFilters();
return $component;
});
4 replies
FFilament
Created by Moudjames23 on 4/13/2023 in #❓┊help
Custom EloquentBuilder based on current user
(Feel free to remove this, if its confusing to the actual question) Sorry I am just learning to code and Im not really familiar of some terminology, so Ill just post here whit my full code. Inside MyWork.php (custom page, sorry for not good naming convention)
<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Resources\Pages\Page;
use App\Models\Task;

class MyWork extends Page
{
protected static string $resource = UserResource::class;
protected static string $view = 'filament.resources.user-resource.pages.my-work';

public $taskWork;

public function mount() {
$userId = auth()->id();

// Check if the authenticated user has a superadmin role
if(auth()->user()->roles->pluck('name')->contains('super_admin')) {
$this->taskWork = Task::get(); // Get all tasks
return;
}

// Otherwise, get tasks assigned to the authenticated user
$this->taskWork = Task::whereRaw('JSON_CONTAINS(assignee_id, \'["' . $userId . '"]\')')->get();
}
}
<?php

namespace App\Filament\Resources\UserResource\Pages;

use App\Filament\Resources\UserResource;
use Filament\Resources\Pages\Page;
use App\Models\Task;

class MyWork extends Page
{
protected static string $resource = UserResource::class;
protected static string $view = 'filament.resources.user-resource.pages.my-work';

public $taskWork;

public function mount() {
$userId = auth()->id();

// Check if the authenticated user has a superadmin role
if(auth()->user()->roles->pluck('name')->contains('super_admin')) {
$this->taskWork = Task::get(); // Get all tasks
return;
}

// Otherwise, get tasks assigned to the authenticated user
$this->taskWork = Task::whereRaw('JSON_CONTAINS(assignee_id, \'["' . $userId . '"]\')')->get();
}
}
This line $this->taskWork = Task::whereRaw('JSON_CONTAINS(assignee_id, \'["' . $userId . '"]\')')->get(); I can make this simplier by using pivot table task_user but I haven't figure it yet. And then I can call this $this->taskWork to my custom blade/views by simply @foreach($taskWork as $work) //do something @endforeach
11 replies
FFilament
Created by Moudjames23 on 4/13/2023 in #❓┊help
Custom EloquentBuilder based on current user
Here you might get an Idea from mine, same goal
$userId = auth()->id();

// Check if the authenticated user has a superadmin role
if(auth()->user()->roles->pluck('name')->contains('super_admin')) {
$this->taskWork = Task::get(); // Get all tasks
return;
}

// Otherwise, get tasks assigned to the authenticated user
$this->taskWork = Task::whereRaw('JSON_CONTAINS(assignee_id, \'["' . $userId . '"]\')')->get();
$userId = auth()->id();

// Check if the authenticated user has a superadmin role
if(auth()->user()->roles->pluck('name')->contains('super_admin')) {
$this->taskWork = Task::get(); // Get all tasks
return;
}

// Otherwise, get tasks assigned to the authenticated user
$this->taskWork = Task::whereRaw('JSON_CONTAINS(assignee_id, \'["' . $userId . '"]\')')->get();
11 replies
FFilament
Created by mcdc on 4/4/2023 in #❓┊help
Store data to pivot table
Thansk for pointing out, ill try this one at home
4 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
my IDE dosent notify it
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
thanks this what i need!!
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
oh no ill try to check it out, or i might have miss something, I use sublime (as vscode is heavy on my device)
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
I already open an issue for this Missing Documentation https://github.com/pxlrbt/filament-environment-indicator/issues/7
28 replies
FFilament
Created by mcdc on 3/28/2023 in #❓┊help
Multiple headerActions on export plugins
I use this environment-indicator FilamentEnvironmentIndicator::configureUsing(function (FilamentEnvironmentIndicator $indicator) { $indicator->showBadge = fn () => false; $indicator->showBorder = fn () => true; }, isImportant: true); I dont know whats the provider I use for this on my AppServiceProvider
28 replies