Eno7x
Eno7x
Explore posts from servers
TLCTuto's Laravel Corner
Created by Eno7x on 10/30/2024 in #💡filament
Policies controls
Hello 😊 I have a page named "TeamVehicle" and before showing it, I wanted to check if there is any package related to "TeamPackage". I checked if a package was created below. What I want to know is whether the code I wrote below is correct or not. And actually this works without any problems. I wanted to learn this so I could write cleaner and smoother code.
// TeamVehiclePolicy.php

public function create(User $user): bool
{
$teamPackage = TeamPackage::query()
->where('is_active', true)
->where('team_id', filament()->getTenant()->id)
->get();

if ($teamPackage->count() > 0) {
return true;
}

return false;
}
// TeamVehiclePolicy.php

public function create(User $user): bool
{
$teamPackage = TeamPackage::query()
->where('is_active', true)
->where('team_id', filament()->getTenant()->id)
->get();

if ($teamPackage->count() > 0) {
return true;
}

return false;
}
4 replies
TLCTuto's Laravel Corner
Created by Eno7x on 9/26/2024 in #🚀laravel
Spatie Translatable - Checkbox list
No description
7 replies
FFilament
Created by Eno7x on 9/23/2024 in #❓┊help
Spatie Translatable - Checkbox list
No description
33 replies
FFilament
Created by Eno7x on 8/27/2024 in #❓┊help
Checkbox list
Hello everyone. I have columns named "name" and "attachments" in the same table. I show the "name" field in "options()" but I don't know how to show the "attachments" field in the "descriptions" field. The "attachments" field in the table is in json format
CheckboxList::make('technologies')
->options([
'tailwind' => 'Tailwind CSS',
'alpine' => 'Alpine.js',
'laravel' => 'Laravel',
'livewire' => 'Laravel Livewire',
])
->descriptions([
'tailwind' => 'A utility-first CSS framework for rapidly building modern websites without ever leaving your HTML.',
'alpine' => new HtmlString('A rugged, minimal tool for composing behavior <strong>directly in your markup</strong>.'),
'laravel' => str('A **web application** framework with expressive, elegant syntax.')->inlineMarkdown()->toHtmlString(),
'livewire' => 'A full-stack framework for Laravel building dynamic interfaces simple, without leaving the comfort of Laravel.',
])
CheckboxList::make('technologies')
->options([
'tailwind' => 'Tailwind CSS',
'alpine' => 'Alpine.js',
'laravel' => 'Laravel',
'livewire' => 'Laravel Livewire',
])
->descriptions([
'tailwind' => 'A utility-first CSS framework for rapidly building modern websites without ever leaving your HTML.',
'alpine' => new HtmlString('A rugged, minimal tool for composing behavior <strong>directly in your markup</strong>.'),
'laravel' => str('A **web application** framework with expressive, elegant syntax.')->inlineMarkdown()->toHtmlString(),
'livewire' => 'A full-stack framework for Laravel building dynamic interfaces simple, without leaving the comfort of Laravel.',
])
8 replies