jals65
jals65
FFilament
Created by jals65 on 10/31/2024 in #❓┊help
User tokens for api
Do you know if exists a plugin to include a view on user profile where users can create an api token? I'm creating an api for my admin panel and I want to prepare middleware to allow token login.
2 replies
FFilament
Created by jals65 on 7/8/2024 in #❓┊help
Action don't works on custom ViewRecord page
I'm having problem when using actions on a custom view of a viewRecord page. The action is printed but don't works. Controller
<?php

namespace Maat\VisualTesting\Resources\VisualTestingResource\Pages;

use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Filament\Support\Enums\MaxWidth;
use Maat\VisualTesting\Resources\VisualTestingResource;
use Maat\VisualTesting\Services\VisualTests\VisualTestsServiceInterface;

class ProjectVisualTests extends ViewRecord
{
protected static string $resource = VisualTestingResource::class;

protected static string $view = 'visual-testing::filament.resources.visual-testing-resource.pages.project-visual-tests';

public function getRegenerateTokenAction(): Action
{
return Action::make('regenerate-token')
->color('success')
->icon('heroicon-o-arrow-path')
->hiddenLabel()
->tooltip('Regenerate token')
->action(function () {
$newToken = app(VisualTestsServiceInterface::class)->regenerateProjectToken($this->record->name);

if (empty($newToken)) {
Notification::make()
->title('Error regenerating token')
->danger()
->send();
}

$this->record->token = $newToken;

Notification::make()
->title('Token regenerated')
->success()
->send();
})
->requiresConfirmation();
}
}
<?php

namespace Maat\VisualTesting\Resources\VisualTestingResource\Pages;

use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Filament\Support\Enums\MaxWidth;
use Maat\VisualTesting\Resources\VisualTestingResource;
use Maat\VisualTesting\Services\VisualTests\VisualTestsServiceInterface;

class ProjectVisualTests extends ViewRecord
{
protected static string $resource = VisualTestingResource::class;

protected static string $view = 'visual-testing::filament.resources.visual-testing-resource.pages.project-visual-tests';

public function getRegenerateTokenAction(): Action
{
return Action::make('regenerate-token')
->color('success')
->icon('heroicon-o-arrow-path')
->hiddenLabel()
->tooltip('Regenerate token')
->action(function () {
$newToken = app(VisualTestsServiceInterface::class)->regenerateProjectToken($this->record->name);

if (empty($newToken)) {
Notification::make()
->title('Error regenerating token')
->danger()
->send();
}

$this->record->token = $newToken;

Notification::make()
->title('Token regenerated')
->success()
->send();
})
->requiresConfirmation();
}
}
View Blade Template
<x-filament::page>
<div class="mr-2">
{{$this->getRegenerateTokenAction()}}
</div>
</x-filament::page>
<x-filament::page>
<div class="mr-2">
{{$this->getRegenerateTokenAction()}}
</div>
</x-filament::page>
5 replies
FFilament
Created by jals65 on 7/4/2024 in #❓┊help
Custom colum view
How can I get the $record->token and print it on a custom column view?
Column::make('test')->view('visual-testing::livewire.visual-testing-test')
Column::make('test')->view('visual-testing::livewire.visual-testing-test')
View:
<div class="flex">
<div>
<p>{{$token}}</p>
</div>
<x-heroicon-o-clipboard class="w-5 cursor-pointer" @click=""/>
</div>
<div class="flex">
<div>
<p>{{$token}}</p>
</div>
<x-heroicon-o-clipboard class="w-5 cursor-pointer" @click=""/>
</div>
7 replies
FFilament
Created by jals65 on 6/25/2024 in #❓┊help
TextInput with follow action
Hi, I'm traying to build a text input with a suffixAction that follows the url typed on the input.
\Filament\Forms\Components\TextInput::make('test')->url()->suffixAction(
Action::make('follow-url')
->icon('heroicon-m-globe-alt')
->url(function ($data) {
return $data->url();
})
->openUrlInNewTab()
)
\Filament\Forms\Components\TextInput::make('test')->url()->suffixAction(
Action::make('follow-url')
->icon('heroicon-m-globe-alt')
->url(function ($data) {
return $data->url();
})
->openUrlInNewTab()
)
How can I get the value typed on the text input?
10 replies
FFilament
Created by jals65 on 5/2/2024 in #❓┊help
Adding id's to filament components
Hi, i'm implementing the visual tests with cypress in my app. And I'm having a problem with the selectors of the elements when it's an element created by a filament component like tables or buttons. It's possible to add selectors to the filament components (tables buttons, actions, etc.) like data-attributes or id's?
6 replies
FFilament
Created by jals65 on 4/15/2024 in #❓┊help
Record variable type change to string if i add the mount function on my viewrecord page
Hi, i'm trying to add an additional viewRecord page on my resource to show some info in an specific type of records. If the record doen't have this specific type, i need to block accessing the page throwing a 404 error. So i'm trying to make a validation on the mount hook of this page. The problem is with the record. If I don't add the mount function, the $this->record is a Model of my record, but when I add the mount function, it it's a string, the name of the record.
6 replies
FFilament
Created by jals65 on 4/11/2024 in #❓┊help
Theme app.css cache busting
I see in filament css links you have the version to prevent cache whent it updates. It's possible to do the same with the app.css? I have this in the AdminPanelProvider.php
->theme(
mix('css/app.css')
)
->theme(
mix('css/app.css')
)
4 replies
FFilament
Created by jals65 on 4/5/2024 in #❓┊help
TextInput default value on edit page
Hi, I want to set a default value on a form text input. I'm adding the ->default('some default string') property but it only works on Create, in the edit it doesn't works even though the value is empty or null. For example, I need this for when I add a new field to the form and for example a user accesses the form when they had previously saved it. So that this field appears already filled in with the default value.
7 replies
FFilament
Created by jals65 on 3/1/2024 in #❓┊help
Issue updating filament from 3.0.92 to 3.2.4
When update filament, it trows this error: Cannot use positional argument after named argument during unpacking vendor/livewire/livewire/src/Features/SupportLifecycleHooks/SupportLifecycleHooks.php(21) I debug and i can see that it have an array with:
$params = [
'project' => 'test',
'build' => 1003394,
0 => null
]
$params = [
'project' => 'test',
'build' => 1003394,
0 => null
]
I think this is because I have an optional param in the url.
5 replies
FFilament
Created by jals65 on 2/13/2024 in #❓┊help
Error adding a link in table with shouldOpenUrlInNewTab()
No description
6 replies
FFilament
Created by jals65 on 1/22/2024 in #❓┊help
Remove value when form field is hidden
I have some dependent fields on my form, when for example a checkbox is selected, other field is hidden. The problem is when the field is hidden, it maintains its value.
27 replies
FFilament
Created by jals65 on 12/21/2023 in #❓┊help
Livewire actions on form component layout
Hi, I'm creating a custom filament form component layout. I need to exec a function in the controller of the component but wire:click is not working for that. I create a public function called addPreset in my controller, and in the element I add a wire:click="addPreset". When I click it trows an error saying method not found.
11 replies
FFilament
Created by jals65 on 11/30/2023 in #❓┊help
Relationships in filters.
No description
3 replies
FFilament
Created by jals65 on 11/16/2023 in #❓┊help
Reload Page after custom action ends.
Hi, I have a custom action where i made some changes on the bbdd, and i need to reload the page at the end of the action, how can i do that?
5 replies
FFilament
Created by jals65 on 11/9/2023 in #❓┊help
Testing using acting as with superadmin.
Hi, i'm using PEST to test some parts of my panel, and I want to make a test to assert that some html is visible. The problem is when i'm trying to use a new user, with super_admin role, but when the page render, it trows 403 forbidden. Here the test:
it('Has contextual menu', function () {
$project = \Maat\Projects\Models\Project::factory()->create();

$user = User::factory()->create();
$user->assignRole('super_admin');

$response = $this->actingAs($user)->get(\Maat\Projects\Resources\ProjectResource::getUrl('view', [
'record' => $project->name
]));

$response->assertSee('<span class="fi-sidebar-item-label flex-1 truncate text-primary-600 dark:text-primary-400 font-semibold">Info</span>');
});
it('Has contextual menu', function () {
$project = \Maat\Projects\Models\Project::factory()->create();

$user = User::factory()->create();
$user->assignRole('super_admin');

$response = $this->actingAs($user)->get(\Maat\Projects\Resources\ProjectResource::getUrl('view', [
'record' => $project->name
]));

$response->assertSee('<span class="fi-sidebar-item-label flex-1 truncate text-primary-600 dark:text-primary-400 font-semibold">Info</span>');
});
8 replies
FFilament
Created by jals65 on 10/31/2023 in #❓┊help
It's possible to add actions in a section of a form?
I'm building a form, and i want to add a button in the header of a section, is that possible?
7 replies
FFilament
Created by jals65 on 10/23/2023 in #❓┊help
Loading a npm package
I have installed a package trow npm: npm install easymde How can I use this package in a livewire component template like this? easyMDE = new EasyMDE({element: document.getElementById('{{$this->getName()}}')});
8 replies
FFilament
Created by jals65 on 10/20/2023 in #❓┊help
The table pagination appears broken
No description
11 replies
FFilament
Created by jals65 on 10/19/2023 in #❓┊help
Bulk action in a dropdown
Now in v3 the bulk actions in a table are displayed in the table header. It's posible to display it on a dropdown like v2?
5 replies
FFilament
Created by jals65 on 10/11/2023 in #❓┊help
Error with some JS files
No description
2 replies