PHP code example of felixmuhoro / laravel-mpesa-filament

1. Go to this page and download the library: Download felixmuhoro/laravel-mpesa-filament 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/ */

    

felixmuhoro / laravel-mpesa-filament example snippets


use FelixMuhoro\MpesaFilament\MpesaFilamentPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... your other panel config
        ->plugin(
            MpesaFilamentPlugin::make()
                ->navigationGroup('Finance')   // optional, default: 'M-Pesa'
                ->navigationSort(10)           // optional
                ->canViewAny(true)             // optional, default: true
        );
}

return [
    'navigation_group'         => 'M-Pesa',
    'navigation_sort'          => null,

    // Override with your own model if needed
    'transaction_model'        => \FelixMuhoro\Mpesa\Models\MpesaTransaction::class,

    'currency_symbol'          => 'KES',
    'chart_days'               => 30,
    'latest_transactions_limit' => 10,

    // Map status strings to Filament badge colors
    'status_colors' => [
        'completed'  => 'success',
        'successful' => 'success',
        'success'    => 'success',
        'failed'     => 'danger',
        'failure'    => 'danger',
        'pending'    => 'warning',
        'processing' => 'info',
        'cancelled'  => 'gray',
    ],

    // Columns 

use FelixMuhoro\MpesaFilament\Actions\InitiateStkPushAction;

// In a custom table:
->actions([
    InitiateStkPushAction::make(),
])

use FelixMuhoro\MpesaFilament\Filters\DateRangeFilter;

->filters([
    DateRangeFilter::make('created_at'),
    DateRangeFilter::make('updated_at'),
])
bash
php artisan vendor:publish --tag="mpesa-filament-config"