vas
vas
FFilament
Created by vas on 2/15/2024 in #❓┊help
Accessing resource from resource manager link
hi i have an OrderResource and an OrdersRelationManager the OrderResource has a view page that is displayed when clicked i would like from the table view when i click the order from the relation manager view to take me to the actual OrderResource view page Any tips on how to achieve this ? thanks
class OrdersRelationManager extends RelationManager
{
protected static string $relationship = 'orders';

public function form(Form $form): Form
{
return OrderResource::form($form);
}

public function table(Table $table): Table
{
return OrderResource::table($table);
}

public function isReadOnly(): bool
{
return false;
}

public function canCreate(): bool
{
return false;
}
class OrdersRelationManager extends RelationManager
{
protected static string $relationship = 'orders';

public function form(Form $form): Form
{
return OrderResource::form($form);
}

public function table(Table $table): Table
{
return OrderResource::table($table);
}

public function isReadOnly(): bool
{
return false;
}

public function canCreate(): bool
{
return false;
}
5 replies
FFilament
Created by vas on 12/30/2023 in #❓┊help
update related model value
class Order extends Model
{
protected $fillable = [
'user_id',
'payment_gateway',
'session_id',
'amount',
'status',
];
public function payment()
{
return $this->hasOne(Payment::class);
}
}



class Payment extends Model
{

protected $fillable = [
'order_id',
'amount',
'status',
];

public function order()
{
return $this->belongsTo(Order::class);
}
}


class PaymentResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([

Forms\Components\Select::make('status')
->required()
->options([
'pending' => PaymentStatusEnum::PENDING->value,
'paid' => PaymentStatusEnum::PAID->value,
'declined' => PaymentStatusEnum::DECLINED->value,
'failed' => PaymentStatusEnum::FAILED->value
])->label('Stare'),



}
}
class Order extends Model
{
protected $fillable = [
'user_id',
'payment_gateway',
'session_id',
'amount',
'status',
];
public function payment()
{
return $this->hasOne(Payment::class);
}
}



class Payment extends Model
{

protected $fillable = [
'order_id',
'amount',
'status',
];

public function order()
{
return $this->belongsTo(Order::class);
}
}


class PaymentResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([

Forms\Components\Select::make('status')
->required()
->options([
'pending' => PaymentStatusEnum::PENDING->value,
'paid' => PaymentStatusEnum::PAID->value,
'declined' => PaymentStatusEnum::DECLINED->value,
'failed' => PaymentStatusEnum::FAILED->value
])->label('Stare'),



}
}
any way to update the orders status to paid when selecting the payment as paid ? thanks
9 replies
FFilament
Created by vas on 12/30/2023 in #❓┊help
Attempted to lazy load [payment] on model [App\Models\Order] but lazy loading is disabled.
i have the following action in the OrderResource
Tables\Actions\Action::make('Download Factura')
->icon('heroicon-o-credit-card')
->color('indigo')
->hidden(fn (Order $order) => $order->payment->status != PaymentStatusEnum::PAID->value)
->url(fn (Order $order) => route('stripe.retrieve.invoice', $order->payment))
->openUrlInNewTab(),
Tables\Actions\Action::make('Download Factura')
->icon('heroicon-o-credit-card')
->color('indigo')
->hidden(fn (Order $order) => $order->payment->status != PaymentStatusEnum::PAID->value)
->url(fn (Order $order) => route('stripe.retrieve.invoice', $order->payment))
->openUrlInNewTab(),
Route::get('/stripe/retrieve_invoice/{payment}', 'App\Http\Controllers\StripeController@retrieve_invoice')->name('stripe.retrieve.invoice');
Route::get('/stripe/retrieve_invoice/{payment}', 'App\Http\Controllers\StripeController@retrieve_invoice')->name('stripe.retrieve.invoice');
as you can see im trying to pass the payment to that route normally i would have
Order::with('payment')
Order::with('payment')
how can i achieve this in filament Thank you
5 replies
FFilament
Created by vas on 12/27/2023 in #❓┊help
make all tailwind classes available
Hi i have a custom infolists component which is a table and not many of the tailwind classes work like bg-gray-100 would work but if i change it to something else it wont i have created a new theme and reg like this
->viteTheme('resources/css/filament/admin/theme.css')
->viteTheme('resources/css/filament/admin/theme.css')
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/app/theme.css','resources/css/filament/admin/theme.css'],
refresh: true,
}),
],
});
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.js', 'resources/css/filament/app/theme.css','resources/css/filament/admin/theme.css'],
refresh: true,
}),
],
});
am i missing something ? thanks
22 replies
FFilament
Created by vas on 12/2/2023 in #❓┊help
Stancl/Tenancy Filament 3
hi i have setup Stancl/Tenancy and its working fine , but i cant get filament to work on tenants subdomain it does load part of the page in the bg but then i get this error
235 replies
FFilament
Created by vas on 12/1/2023 in #❓┊help
change options for custom panel
hi i have 2 panels 1 the default admin and second one its called app i have added
->maxContentWidth('full')
->sidebarCollapsibleOnDesktop()
->maxContentWidth('full')
->sidebarCollapsibleOnDesktop()
in AdminPanelProvider but the return function its for admin
return $panel
->default()
->id('admin')
->path('admin')
return $panel
->default()
->id('admin')
->path('admin')
how can i do the same for app panel thanks
4 replies
FFilament
Created by vas on 10/6/2023 in #❓┊help
field disabled on the edit page and hidden on the create new record page
hi i would like to have this field disabled on the edit page and hidden on the create new record page
Forms\Components\TextInput::make('user_id')
->required()
->maxLength(255),
Forms\Components\TextInput::make('user_id')
->required()
->maxLength(255),
any idea how could i accomplish this ? thank you
53 replies
FFilament
Created by vas on 10/4/2023 in #❓┊help
Restrict user access to different panels based on roles
i have 2 panels one is the default admin one and second one lets call it superadmin i would like to restrict access to admin only for the users that is_admin returns true for example and is_superadmin for superadmin
15 replies
FFilament
Created by vas on 10/4/2023 in #❓┊help
exposing a form to normal user
hi i have a form in the admin area for submitting a post , how can i use the same form in the homepage for an user to being able to submit data
21 replies
FFilament
Created by vas on 10/4/2023 in #❓┊help
file upload size
hi any idea why i can't upload files more than 1MB in production using filepond i have set upload_max_filesize 100M 100M post_max_size 100M 100M 'rules' => 'max:200000', // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB) in livewire.php livewire.js?id=3605227a:3578 POST .../livewire/upload-file?expires=1696423665&signature=ba27d531e72aee40dfdca79aea9ef311c028e369ae99d33c848510e3a15016ae 413 (Payload Too Large)
13 replies
FFilament
Created by vas on 10/3/2023 in #❓┊help
how can i go about adding a back to main page link on the dashboard
No description
17 replies
FFilament
Created by vas on 9/30/2023 in #❓┊help
Error when saving after cropping image
[2023-09-30 04:23:03] production.ERROR: Unable to retrieve the file_size for file at location: livewire-tmp/livewire-tmp. {"userId":1,"exception":"[object] (League\Flysystem\UnableToRetrieveMetadata(code: 0): Unable to retrieve the file_size for file at location: livewire-tmp/livewire-tmp. at /home/vas/umbra/vendor/league/flysystem/src/UnableToRetrieveMetadata.php:49) any idea why i get this error in production
3 replies
FFilament
Created by vas on 9/6/2023 in #❓┊help
Integer value displayed incorrectly
hey i have the following table column
$table->bigInteger('steam_id')->nullable();
$table->bigInteger('steam_id')->nullable();
with the value of 76561198065698992 in the db , and table view is the same but when i click edit is being displayed as 76561198065698990 so the 2 at the end is 0 any idea what is causing this
Forms\Components\TextInput::make('steam_id')
->required()
->numeric(),


Tables\Columns\TextColumn::make('steam_id')
->numeric()
->sortable(),
Forms\Components\TextInput::make('steam_id')
->required()
->numeric(),


Tables\Columns\TextColumn::make('steam_id')
->numeric()
->sortable(),
24 replies
FFilament
Created by vas on 4/11/2023 in #❓┊help
MIME type ('text/html') is not executable, and strict MIME type checking is enabled
ps://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67 net::ERR_ABORTED 404 admin:1 Refused to execute script from 'https://arknext.io/filament/assets/app.js?id=9cf00a680eed0bca655a7d74a5f4ce67' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. any idea why i get this in production , im using nginx
40 replies