PHP Classes

File: helpers.php

Recommend this page to a friend!
  Classes of Nyi Nyi Lwin   Laravel SAAS Boilerplate   helpers.php   Download  
File: helpers.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Laravel SAAS Boilerplate
Base application to develop software as a service
Author: By
Last change:
Date: 1 year ago
Size: 1,019 bytes
 

Contents

Class file image Download
<?php

use Stripe\Charge;

if (!
function_exists('include_route_files')) {

   
/**
     * Loops through a folder and requires all PHP files
     * Searches sub-directories as well.
     *
     * @param $folder
     */
   
function include_route_files($folder)
    {
        try {
           
$rdi = new recursiveDirectoryIterator($folder);
           
$it = new recursiveIteratorIterator($rdi);

            while (
$it->valid()) {
                if (!
$it->isDot() && $it->isFile() && $it->isReadable() && $it->current()->getExtension() === 'php') {
                    require
$it->key();
                }

               
$it->next();
            }
        } catch (
Exception $e) {
            echo
$e->getMessage();
        }
    }
}


if (!
function_exists('is_refunded')) {
    function
is_refunded($id)
    {
       
$charge = (Charge::retrieve(['id' => $id, 'expand' => ['balance_transaction']], ['api_key' => config('services.stripe.secret')]))->toArray();
        return
$charge['amount_refunded'];
    }
}