From 38223ff3fe5693b160d444e75c471399d11e74aa Mon Sep 17 00:00:00 2001 From: Pradeep Date: Tue, 7 Mar 2023 00:30:45 +0530 Subject: [PATCH] updated: ,ibraries --- Libraries/VaahAjax.php | 2 +- Libraries/VaahArtisan.php | 9 ++++++++- Libraries/VaahDB.php | 23 +++++++++++++++++++++++ Libraries/VaahStripe.md | 34 +++++++++++++++++----------------- composer.json | 2 +- 5 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 Libraries/VaahDB.php diff --git a/Libraries/VaahAjax.php b/Libraries/VaahAjax.php index 9c9575c..05ebff9 100644 --- a/Libraries/VaahAjax.php +++ b/Libraries/VaahAjax.php @@ -39,7 +39,7 @@ public function post($url, $params=null, $headers = null) }catch(\Exception $e) { $response['status'] = 'failed'; - $response['errors'][] = $e->getMessage(); + $response['errors'] = [$e->getMessage()]; } return $response; diff --git a/Libraries/VaahArtisan.php b/Libraries/VaahArtisan.php index 5118897..97c6bda 100644 --- a/Libraries/VaahArtisan.php +++ b/Libraries/VaahArtisan.php @@ -17,6 +17,7 @@ public static function setParams() //------------------------------------------------- public static function validateMigrateCommands($command) { + $response = []; //acceptable commands $commands = [ "migrate", @@ -30,7 +31,7 @@ public static function validateMigrateCommands($command) if(!in_array($command, $commands)) { $response['status'] = 'failed'; - $response['errors'][] = 'Invalid command'; + $response['errors'] = ['Invalid command']; if(env('APP_DEBUG')) { $response['hint']['acceptable_commands'] = $commands; @@ -44,6 +45,7 @@ public static function validateMigrateCommands($command) //------------------------------------------------- public static function artisan() { + $response = []; try{ \Artisan::call(self::$command, self::$params); $response['status'] = 'success'; @@ -84,6 +86,11 @@ public static function migrationReset($path=null, $db_connection_name=null) return self::migrate('migrate:reset', $db_connection_name, $path); } //------------------------------------------------- + public static function migrationFresh($db_connection_name=null) + { + return self::migrate('migrate:fresh', $db_connection_name); + } + //------------------------------------------------- public static function validateSeedCommand($command) { //acceptable commands diff --git a/Libraries/VaahDB.php b/Libraries/VaahDB.php new file mode 100644 index 0000000..729bfb6 --- /dev/null +++ b/Libraries/VaahDB.php @@ -0,0 +1,23 @@ +getPdo(); + } catch (\Exception $e) { + return false; + } + } + + public static function isTableExist($table) + { + return Schema::hasTable($table); + } + +} diff --git a/Libraries/VaahStripe.md b/Libraries/VaahStripe.md index 2641a17..feff3c0 100644 --- a/Libraries/VaahStripe.md +++ b/Libraries/VaahStripe.md @@ -33,7 +33,7 @@ Add Facade in `config/app.php`: ``` Add env configuration: -``` +```env ... STRIPE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx @@ -47,27 +47,27 @@ Reference url: https://stripe.com/docs/api - Stripe One Time Payment -``` +```php - $customer => [ + $customer = [ 'name' => 'xxxxxx', 'email' => 'xx@example.com' ]; - $card => [ + $card = [ 'number' => 'xxxx-xxxx-xxxx-xxxx', 'exp_month' => '01', // 01-12 'exp_year' => '2021', 'cvc' => 'xxx' ]; - $package => [ + $package = [ 'currency' => 'usd', // usd / USD 'amount' => '01', 'description' => 'xxxxxx' ]; - $address => [ + $address = [ 'city' => 'xxxxxx', // optional 'country' => 'xxxxxx', 'line1' => 'xxxxxx', @@ -76,7 +76,7 @@ Reference url: https://stripe.com/docs/api 'state' => 'xxxxxx' // optional ]; - $return_url // URL to redirect your customer back to after they authenticate or cancel their payment + $return_url = ""; // URL to redirect your customer back to after they authenticate or cancel their payment \VaahStripe::pay($customer, $card, $package, $address, $return_url); @@ -85,19 +85,19 @@ Reference url: https://stripe.com/docs/api - Stripe Subscription ```php - $customer => [ + $customer = [ 'name' => 'xxxxxx', 'email' => 'xx@example.com' ]; - $card => [ + $card = [ 'number' => 'xxxx-xxxx-xxxx-xxxx', 'exp_month' => '01', // 01-12 'exp_year' => '2021', 'cvc' => 'xxx' ]; - $address => [ + $address = [ 'city' => 'xxxxxx', // optional 'country' => 'xxxxxx', 'line1' => 'xxxxxx', @@ -106,9 +106,9 @@ Reference url: https://stripe.com/docs/api 'state' => 'xxxxxx' // optional ]; - $price_id // Price define the unit cost, currency, and (optional) billing cycle for Subcription + $price_id = 50; // Price define the unit cost, currency, and (optional) billing cycle for Subcription - $return_url // URL to redirect your customer back to after they authenticate or cancel their payment + $return_url = ""; // URL to redirect your customer back to after they authenticate or cancel their payment \VaahStripe::subscription($customer, $card, $address, $price_id, $return_url); @@ -117,7 +117,7 @@ Reference url: https://stripe.com/docs/api - Create Product ```php - $request => [ + $request = [ 'name' => 'xxxxxx', 'description' => 'xxxxxx' ]; @@ -129,7 +129,7 @@ Reference url: https://stripe.com/docs/api - Create Price ```php - $request => [ + $request = [ 'product_id' => 'xxxxxx', 'currency' => 'usd', 'amount' => '01', @@ -151,11 +151,11 @@ Reference url: https://stripe.com/docs/api - Find Price ```php - $product_id + $product_id = 1; - $value //optional + $value = ""; //optional - $by //optional default = amount amount/currency/interval + $by = ""; //optional default = amount amount/currency/interval \VaahStripe::getProductPrice($product_id, $value, $by); diff --git a/composer.json b/composer.json index 60b1af1..77f14b8 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,7 @@ ], "require": { "php": "^7.4|^8.0", - "php-imap/php-imap": "^4.0", + "php-imap/php-imap": "^5.0", "ext-json": "*", "ext-imap": "*", "ext-curl": "*",