Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

develop to main #106

Merged
merged 11 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Laravel
name: Prod

on:
push:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/laravel_dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Dev

on:
push:
branches: [ "develop" ]
paths-ignore:
- .github/**
- docs/**
pull_request:
branches: [ "develop" ]

jobs:
laravel-tests:
runs-on: ubuntu-latest
container:
image: kirschbaumdevelopment/laravel-test-runner:8.1
services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: test
ports:
- 33306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.1'
- uses: actions/checkout@v3
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: composer update
run: composer update
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Generate key
run: php artisan key:generate
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via pest
env:
DB_CONNECTION: mysql
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
run: php artisan migrate && php artisan db:seed
- name: Sync to Server 1 and Do it
uses: appleboy/ssh-action@master
env:
GITHUB_SHA_X: ${GITHUB_SHA}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
port: ${{secrets.SSH_PORT }}
script: |
cd ${{ secrets.WWW_DEV_DIR }} && sudo git pull
composer update
php artisan migrate && php artisan db:seed
vendor/bin/pest
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
namespace Nicelizhi\OneBuy\Console\Commands\Countries;

use Exception;
use Illuminate\Console\Command;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;

class StateCopy extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'onebuy:countries:state:copy';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Countries State Copy';

/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$dst_dir = public_path("template-common/checkout1/state");

$langs = [
'en',
'de',
'fr',
'es'
];


$dir = scandir($dst_dir);
foreach($dir as $key=>$d) {
if($d=='.' || $d=='..') continue;
if(strlen($d)!=7) continue;
$dpath = pathinfo($d);
foreach($langs as $lang) {
$dst_file = $dst_dir.'/'.$dpath['filename']."_".$lang.".json";
$this->info($dst_file);
if(!file_exists($dst_file)) {
$source = file_get_contents($dst_dir.'/'.$dpath['filename'].".json");
file_put_contents($dst_file, $source);
}
}
//var_dump($dpath);exit;
}
}
}
21 changes: 21 additions & 0 deletions packages/Nicelizhi/OneBuy/src/Database/Seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Nicelizhi\Onebuy\Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Event;


class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(ProductAttrTableSeeder::class);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

namespace Nicelizhi\OneBuy\Database\Seeders;

use Carbon\Carbon;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class ProductAttrTableSeeder extends Seeder {
public function run()
{
$now = Carbon::now();
DB::table('attributes')->insert([
[
'id' => 29,
'code' => 'headercontainerbg',
'admin_name' => 'header container bg PC 2048*330',
'type' => 'image',
'validation' => NULL,
'position' => NULL,
'is_required' => 0,
'is_unique' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
'default_value' => NULL,
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 1,
'is_visible_on_front' => 0,
'created_at' => $now,
'updated_at' => $now,
'is_comparable' => 0,
], [
'id' => 30,
'code' => 'headercontainerbg1',
'admin_name' => 'header container bg Mobile 700*224',
'type' => 'image',
'validation' => NULL,
'position' => NULL,
'is_required' => 0,
'is_unique' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
'default_value' => NULL,
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 1,
'is_visible_on_front' => 0,
'created_at' => $now,
'updated_at' => $now,
'is_comparable' => 0,
],
[
'id' => 31,
'code' => 'compare_at_price',
'admin_name' => 'compare_at_price',
'type' => 'price',
'validation' => NULL,
'position' => NULL,
'is_required' => 0,
'is_unique' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
'default_value' => NULL,
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 1,
'is_visible_on_front' => 0,
'created_at' => $now,
'updated_at' => $now,
'is_comparable' => 0,
],
[
'id' => 32,
'code' => 'product_size_img',
'admin_name' => 'Product Size Image',
'type' => 'image',
'validation' => NULL,
'position' => NULL,
'is_required' => 0,
'is_unique' => 0,
'value_per_locale' => 0,
'value_per_channel' => 0,
'default_value' => NULL,
'is_filterable' => 0,
'is_configurable' => 0,
'is_user_defined' => 1,
'is_visible_on_front' => 0,
'created_at' => $now,
'updated_at' => $now,
'is_comparable' => 0,
]
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ protected function registerCommands(): void
if ($this->app->runningInConsole()) {
$this->commands([
\Nicelizhi\OneBuy\Console\Commands\Countries\Get::class,
\Nicelizhi\OneBuy\Console\Commands\Countries\StateCopy::class,
\Nicelizhi\OneBuy\Console\Commands\Order\CartToOrder::class,
\Nicelizhi\OneBuy\Console\Commands\Imports\ImportFaq::class,
\Nicelizhi\OneBuy\Console\Commands\Imports\ImportProductComments::class,
Expand Down
Loading
Loading