PHP code example of tomatophp / filament-withdrawals
1. Go to this page and download the library: Download tomatophp/filament-withdrawals library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tomatophp / filament-withdrawals example snippets
use Bavix\Wallet\Interfaces\Wallet;
use Bavix\Wallet\Traits\HasWalletFloat;
class User extends Authenticatable implements Wallet
{
use HasWalletFloat;
}
return [
// Currency used to format amounts on the withdrawal screens.
'currency' => env('FILAMENT_WITHDRAWALS_CURRENCY', 'USD'),
// Default owner model for requests created by the model factory.
'user_model' => \App\Models\User::class,
// Optional accounts guard (tomatophp/filament-accounts). When a user is signed in on this guard,
// form-builder requests are created for that account; otherwise the default guard's user is used.
'accounts' => [
'guard' => 'accounts',
],
];
use Filament\Forms\Components\CodeEditor;
use TomatoPHP\FilamentWithdrawals\Services\FilamentWithdrawalFormFields;
use TomatoPHP\FilamentWithdrawals\Services\Contracts\WithdrawalFormFieldType;
FilamentWithdrawalFormFields::register([
WithdrawalFormFieldType::make('code')
->className(CodeEditor::class)
->color('warning')
->icon('heroicon-s-code-bracket-square')
->label('Code Editor'),
]);
use TomatoPHP\FilamentWithdrawals\Services\FilamentWithdrawalFormBuilder;
FilamentWithdrawalFormBuilder::make(1)->build(); // Filament form components, always ending with the `amount` field
use TomatoPHP\FilamentWithdrawals\Services\FilamentWithdrawalFormBuilder;
FilamentWithdrawalFormBuilder::make(1)->send($data); // returns the WithdrawalRequest, or null with a notification