kian
kian
FFilament
Created by kian on 5/7/2024 in #❓┊help
Creating redirects from old pages to new ones
For a website I need to implement redirects that will route the user from the old admin panel to the new one. I found this plugin that does exactly what I need, but it seems to be decrepitated, cant find the github page for it either. (https://v2.filamentphp.com/plugins/redirects). Anyone know another plugin that does this? If not, what is the best way to implement something like this?
7 replies
FFilament
Created by kian on 4/2/2024 in #❓┊help
Create action on custom page
I made a custom page and want to add a 'new' button to it. I added it, when i press it it shows an empty model with only buttons.
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->record(new Page())
];
}
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make()
->record(new Page())
];
}
how can i make it so it opens a modal with fields?
14 replies
FFilament
Created by kian on 3/14/2024 in #❓┊help
Warning/error message on click field
Is it possible to add a warning at the bottom of a TextInput field? I am building a custom package that interacts with normal fields. Right now I show an alert, is it possible with filament to do this?
2 replies
FFilament
Created by kian on 3/11/2024 in #❓┊help
Disable dehydrated by default on custom field
No description
5 replies
FFilament
Created by kian on 3/7/2024 in #❓┊help
Show date to frontend, but save another
What would be the best way to show data to the frontend, but save something different to the db? I am making a custom input field, which is connected to an API. I want a single value of the api response to be shown inside of the input field, but want to save the full json to the database.
4 replies
FFilament
Created by kian on 3/6/2024 in #❓┊help
Ignore using filament:assets for package
I am using this package for inspiration: https://github.com/cheesegrits/filament-google-maps and found you don't have to use php artisan filament:assets when using the package. In the package im currently building, this is still a required step. Is there a way I could implement this?
2 replies
FFilament
Created by kian on 2/29/2024 in #❓┊help
Set value without a field
Is there a way to set a value that is available in the database, but not in the form? I know you can hide a field and then set it, but thats not what im looking for.
5 replies
FFilament
Created by kian on 2/26/2024 in #❓┊help
get data of form with custom field
How can i get the data of the form with a custom field? I need the data of the form when on the edit page
8 replies
FFilament
Created by kian on 2/23/2024 in #❓┊help
Custom validation in custom field
Is there a way to add custom validation rules to custom fields? I have a custom field containing a regular input field, and want to verify the content before the user can proceed. What would be the best way to do this?
2 replies
FFilament
Created by kian on 2/22/2024 in #❓┊help
Using api key from backend to frontend
I am working on a project where I need an API key in the frontend. I have the api key stored in the backend, and now have set up the javascript for this to get to the frontend, code is down below. Is there a way to hide this key? Right now it gets shown in the sources. Or is this not possible at all?
// Import any external JavaScript libraries from NPM here.

export default function testComponent({
state,
mapsUrl,
}) {
return {
state,

// You can define any other Alpine.js properties here.

init: function () {
// You can define any other Alpine.js initialization code here
},

loadMaps: async function () {
console.log(mapsUrl);
}

// You can define any other Alpine.js functions here.
}
}
// Import any external JavaScript libraries from NPM here.

export default function testComponent({
state,
mapsUrl,
}) {
return {
state,

// You can define any other Alpine.js properties here.

init: function () {
// You can define any other Alpine.js initialization code here
},

loadMaps: async function () {
console.log(mapsUrl);
}

// You can define any other Alpine.js functions here.
}
}
4 replies
FFilament
Created by kian on 2/22/2024 in #❓┊help
Linking javascript file to component
What is the best way to link a javascript file to a component? I want to be able to run functions of the js file in my component, and be able to use $wire inside it, but cant figure out how to link them together. I've done research but there isnt really a good docs that helps me with this.
8 replies
FFilament
Created by kian on 2/21/2024 in #❓┊help
unable to call method
I am new to filament, and got assigned to a project to make a custom field for searching location through google maps api. I am getting a little stick here. I'm using
$wire.newLocations($event.target.value)
$wire.newLocations($event.target.value)
to try and call a method in my component class (GeoMap), but keep getting this error Unable to call component method. Public method [newLocations] not found on component. When I post this method in my CreateLocation class it does work however. What is the reason for this, and how can I fix this?
// GeoMap.php
class GeoMap extends Field
{
use HasExtraAlpineAttributes;

protected string $view = 'forms.components.geo-map';

protected float | Closure $lat = 0;

protected float | Closure $lon = 0;


public function getMapsUrl(): string
{
return MapsHelper::getMapUrl();
}

public function newLocations($address): array
{
return MapsHelper::getLocations($address);
}
}
// GeoMap.php
class GeoMap extends Field
{
use HasExtraAlpineAttributes;

protected string $view = 'forms.components.geo-map';

protected float | Closure $lat = 0;

protected float | Closure $lon = 0;


public function getMapsUrl(): string
{
return MapsHelper::getMapUrl();
}

public function newLocations($address): array
{
return MapsHelper::getLocations($address);
}
}
5 replies