balance start
This commit is contained in:
parent
c0c8197d63
commit
d380df4cbb
|
|
@ -23,8 +23,7 @@ class Category extends JsonResource
|
|||
'display_mode' => $this->display_mode,
|
||||
'description' => $this->description,
|
||||
'parent_id' => $this->parent_id,
|
||||
'image_url' => $this->image_url,
|
||||
'icon_path' => $this->category_icon_path
|
||||
'image_url' => $this->category_icon_path
|
||||
? Storage::url($this->category_icon_path)
|
||||
: $this->image_url,
|
||||
// 'additional' => is_array($this->resource->additional)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace TPS\Shop\Contracts;
|
||||
|
||||
interface Balance
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace TPS\Shop\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use TPS\Shop\Contracts\Balance as BalanceContract;
|
||||
use Webkul\Customer\Models\CustomerProxy;
|
||||
|
||||
class Balance extends Model implements BalanceContract
|
||||
{
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'customer_id',
|
||||
'type',
|
||||
'amount',
|
||||
];
|
||||
|
||||
public function customer() : BelongsTo{
|
||||
return $this->belongsTo(CustomerProxy::modelClass());
|
||||
}
|
||||
|
||||
//todo belongs to transaction??
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\DataFaker\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Webkul\Core\Repositories\CountryRepository;
|
||||
use Webkul\Core\Repositories\CountryStateRepository;
|
||||
use Webkul\Customer\Repositories\CustomerGroupRepository;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
/**
|
||||
* Customer Reposotory
|
||||
*
|
||||
* @copyright 2019 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class CustomerRepository
|
||||
{
|
||||
/**
|
||||
* Country Repository Object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $countryRepository;
|
||||
|
||||
/**
|
||||
* Country State Repository Object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $countryStateRepository;
|
||||
|
||||
/**
|
||||
* Customer Group Repository Object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customerGroupRepository;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param Webkul\Core\Repositories\CountryRepository $countryRepository
|
||||
* @param \Webkul\Core\Repositories\CountryStateRepository $countryStateRepository
|
||||
* @param Webkul\Customer\Repositories\CustomerGroupRepository $customerGroupRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
CountryRepository $countryRepository,
|
||||
CountryStateRepository $countryStateRepository,
|
||||
CustomerGroupRepository $customerGroupRepository
|
||||
)
|
||||
{
|
||||
$this->countryRepository = $countryRepository;
|
||||
|
||||
$this->countryStateRepository = $countryStateRepository;
|
||||
|
||||
$this->customerGroupRepository = $customerGroupRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy Data For Customer Table.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function customerDummyData($faker)
|
||||
{
|
||||
$gender = $faker->randomElement(['male', 'female']);
|
||||
|
||||
$customerGroup = $this->customerGroupRepository->get()->random();
|
||||
|
||||
return [
|
||||
'first_name' => $faker->firstName($gender),
|
||||
'last_name' => $faker->lastName,
|
||||
'gender' => $gender,
|
||||
'date_of_birth' => $faker->date($format = 'Y-m-d', $max = 'now'),
|
||||
'email' => $faker->unique()->safeEmail(),
|
||||
'phone' => $faker->e164PhoneNumber,
|
||||
'password' => bcrypt('admin123'),
|
||||
'customer_group_id' => $customerGroup->id,
|
||||
'is_verified' => 1,
|
||||
'remember_token' =>str_random(10)
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue