-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0112092
commit ff22bd1
Showing
71 changed files
with
957 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use Faker\Generator as Faker; | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Model Factories | ||
|-------------------------------------------------------------------------- | ||
| | ||
| This directory should contain each of the model factory definitions for | ||
| your application. Factories provide a convenient way to generate new | ||
| model instances for testing / seeding your application's database. | ||
| | ||
*/ | ||
|
||
$factory->define(GetCandy\Api\Core\Products\Models\ProductVariant::class, function (Faker $faker) { | ||
return [ | ||
'sku' => $faker->unique()->slug, | ||
'stock' => $faker->numberBetween(10, 2000), | ||
'price' => $faker->randomNumber(2), | ||
]; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
database/migrations/2020_12_21_123125_create_payment_provider_users_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreatePaymentProviderUsersTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('payment_provider_users', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
$userIdColType = Schema::getColumnType('users', 'id'); | ||
|
||
if ($userIdColType == 'integer') { | ||
$table->unsignedInteger('user_id'); | ||
$table->foreign('user_id')->references('id')->on('users'); | ||
} else { | ||
$table->foreignId('user_id')->constrained(); | ||
} | ||
|
||
$table->string('provider_id')->index(); | ||
$table->string('provider')->index(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('reusable_payments', function (Blueprint $table) { | ||
$table->dropColumn('meta'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace GetCandy\Api\Core\Categories\Observers; | ||
|
||
use GetCandy\Api\Core\Assets\Services\AssetService; | ||
use GetCandy\Api\Core\Categories\Models\Category; | ||
use GetCandy\Api\Core\Search\SearchManager; | ||
|
||
class CategoryObserver | ||
{ | ||
/** | ||
* @var \GetCandy\Api\Core\Assets\Services\AssetService | ||
*/ | ||
protected $assets; | ||
|
||
protected $search; | ||
|
||
public function __construct(AssetService $assets, SearchManager $search) | ||
{ | ||
$this->assets = $assets; | ||
$this->search = $search; | ||
} | ||
|
||
/** | ||
* Handle the User "deleted" event. | ||
* | ||
* @param \GetCandy\Api\Core\Categories\Models\Category $category | ||
* @return void | ||
*/ | ||
public function deleted(Category $category) | ||
{ | ||
$driver = $this->search->with(config('getcandy.search.driver')); | ||
$driver->delete($category); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.