diff --git a/composer.json b/composer.json
index beb84f01f..6624edda5 100644
--- a/composer.json
+++ b/composer.json
@@ -37,7 +37,8 @@
"webkul/laravel-category": "self.version",
"webkul/laravel-product": "self.version",
"webkul/laravel-shop": "self.version",
- "webkul/laravel-theme": "self.version"
+ "webkul/laravel-theme": "self.version",
+ "webkul/laravel-shipping": "self.version"
},
"autoload": {
"classmap": [
@@ -57,7 +58,8 @@
"Webkul\\Inventory\\": "packages/Webkul/Inventory/src",
"Webkul\\Product\\": "packages/Webkul/Product/src",
"Webkul\\Theme\\": "packages/Webkul/Theme/src",
- "Webkul\\Cart\\": "packages/Webkul/Cart/src"
+ "Webkul\\Cart\\": "packages/Webkul/Cart/src",
+ "Webkul\\Shipping\\": "packages/Webkul/Shipping/src"
}
},
"autoload-dev": {
diff --git a/config/app.php b/config/app.php
index d7d6cb7ae..856fbf5a1 100644
--- a/config/app.php
+++ b/config/app.php
@@ -191,6 +191,7 @@ return [
Webkul\Customer\Providers\CustomerServiceProvider::class,
Webkul\Theme\Providers\ThemeServiceProvider::class,
Webkul\Cart\Providers\CartServiceProvider::class,
+ Webkul\Shipping\Providers\ShippingServiceProvider::class,
],
/*
diff --git a/config/carrier.php b/config/carrier.php
new file mode 100644
index 000000000..84b260d3c
--- /dev/null
+++ b/config/carrier.php
@@ -0,0 +1,17 @@
+ 'flatrate',
+ 'title' => 'Flat Rate',
+ 'description' => 'this is a flat rate',
+ 'status' => '1',
+ 'type' => [
+ 'per unit' => 'Per Unit',
+ 'per order' => 'Per Order',
+ ],
+ ]
+]
+
+?>
\ No newline at end of file
diff --git a/packages/Webkul/Admin/src/Http/routes.php b/packages/Webkul/Admin/src/Http/routes.php
index 9e4224ef0..a98ff0be2 100644
--- a/packages/Webkul/Admin/src/Http/routes.php
+++ b/packages/Webkul/Admin/src/Http/routes.php
@@ -53,6 +53,14 @@ Route::group(['middleware' => ['web']], function () {
'view' => 'admin::customers.review.index'
])->name('admin.customer.review.index');
+ Route::get('customer/create', 'Webkul\Core\Http\Controllers\CustomerController@create')->defaults('_config',[
+ 'view' => 'admin::customers.create'
+ ])->name('admin.customer.create');
+
+ Route::post('customer/create', 'Webkul\Core\Http\Controllers\CustomerController@store')->defaults('_config',[
+ 'redirect' => 'admin.customer.index'
+ ])->name('admin.customer.store');
+
Route::get('customer/reviews/edit/{id}', 'Webkul\Shop\Http\Controllers\ReviewController@edit')->defaults('_config',[
'view' => 'admin::customers.review.edit'
])->name('admin.customer.review.edit');
diff --git a/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php
new file mode 100644
index 000000000..ebdd9e812
--- /dev/null
+++ b/packages/Webkul/Admin/src/Resources/views/customers/create.blade.php
@@ -0,0 +1,83 @@
+@extends('admin::layouts.content')
+
+@section('content')
+
+@stop
\ No newline at end of file
diff --git a/packages/Webkul/Admin/src/Resources/views/customers/edit.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/edit.blade.php
index 1388fd16d..245b9bac6 100644
--- a/packages/Webkul/Admin/src/Resources/views/customers/edit.blade.php
+++ b/packages/Webkul/Admin/src/Resources/views/customers/edit.blade.php
@@ -63,11 +63,14 @@
{{ __('admin::app.customers.customers.customer_group') }}
+ customerGroup->id ?>
- 1
- 2
- 3
- 4
+ @foreach($customerGroup as $group)
+ id ? 'selected' : '' }}>
+ {{ $group->group_name}}
+
+ @endforeach
+
diff --git a/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php b/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php
index 6a7127324..475d8afcc 100644
--- a/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php
+++ b/packages/Webkul/Admin/src/Resources/views/customers/index.blade.php
@@ -12,7 +12,7 @@
{{ __('admin::app.customers.customers.title') }}
diff --git a/packages/Webkul/Core/src/Http/Controllers/CustomerController.php b/packages/Webkul/Core/src/Http/Controllers/CustomerController.php
index 5296b7f29..3ec3076e5 100644
--- a/packages/Webkul/Core/src/Http/Controllers/CustomerController.php
+++ b/packages/Webkul/Core/src/Http/Controllers/CustomerController.php
@@ -5,7 +5,8 @@ namespace Webkul\Core\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
-use Webkul\Customer\Models\Customer;
+use Webkul\Customer\Repositories\CustomerRepository as Customer;
+use Webkul\Customer\Repositories\CustomerGroupRepository as CustomerGroup;
/**
* Customer controlller for the customer
@@ -17,15 +18,40 @@ use Webkul\Customer\Models\Customer;
class CustomerController extends Controller
{
/**
- * Display a listing of the resource.
+ * Contains route related configuration
*
- * @return \Illuminate\Http\Response
+ * @var array
*/
protected $_config;
- public function __construct()
+ /**
+ * CustomerRepository object
+ *
+ * @var array
+ */
+ protected $customer;
+
+ /**
+ * CustomerGroupRepository object
+ *
+ * @var array
+ */
+ protected $customerGroup;
+
+ /**
+ * Create a new controller instance.
+ *
+ * @param Webkul\Customer\Repositories\CustomerRepository as customer;
+ * @param Webkul\Customer\Repositories\CustomerGroupRepository as customerGroup;
+ * @return void
+ */
+ public function __construct(Customer $customer , CustomerGroup $customerGroup )
{
$this->_config = request('_config');
+
+ $this->customer = $customer;
+
+ $this->customerGroup = $customerGroup;
}
/**
@@ -38,6 +64,47 @@ class CustomerController extends Controller
return view($this->_config['view']);
}
+ /**
+ * Show the form for creating a new resource.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function create()
+ {
+ $customerGroup = $this->customerGroup->all();
+
+ return view($this->_config['view'],compact('customerGroup'));
+ }
+
+ /**
+ * Store a newly created resource in storage.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function store(Request $request)
+ {
+ $request->validate([
+
+ 'first_name' => 'string|required',
+ 'last_name' => 'string|required',
+ 'email' => 'email|required',
+
+ ]);
+
+ $data=$request->all();
+
+ $password = bcrypt(rand(100000,10000000));
+
+ $data['password']=$password;
+
+ $this->customer->create($data);
+
+ session()->flash('success', 'Customer created successfully.');
+
+ return redirect()->route($this->_config['redirect']);
+
+ }
+
/**
* Show the form for editing the specified resource.
*
@@ -46,11 +113,11 @@ class CustomerController extends Controller
*/
public function edit($id)
{
- $customer = Customer::find($id);
+ $customer = $this->customer->findOneWhere(['id'=>$id]);
- dd($customer->customerGroup->group_name);
+ $customerGroup = $this->customerGroup->all();
- return view($this->_config['view'],compact('customer'));
+ return view($this->_config['view'],compact('customer','customerGroup'));
}
/**
@@ -62,9 +129,8 @@ class CustomerController extends Controller
*/
public function update(Request $request, $id)
{
- $customer = Customer::find($id);
- $customer->update(request()->all(), [$id]);
+ $this->customer->update(request()->all(),$id);
session()->flash('success', 'Customer updated successfully.');
diff --git a/packages/Webkul/Customer/src/Database/migrations/2018_07_24_082930_create_customers_table.php b/packages/Webkul/Customer/src/Database/migrations/2018_07_24_082930_create_customers_table.php
index 7713f96a0..bd5ea3ebb 100644
--- a/packages/Webkul/Customer/src/Database/migrations/2018_07_24_082930_create_customers_table.php
+++ b/packages/Webkul/Customer/src/Database/migrations/2018_07_24_082930_create_customers_table.php
@@ -21,6 +21,7 @@ class CreateCustomersTable extends Migration
$table->date('date_of_birth')->nullable();
$table->string('phone')->unique()->nullable();
$table->string('email')->unique();
+ $table->tinyInteger('status')->default(1);
$table->string('password');
$table->integer('customer_group_id')->unsigned()->nullable();
$table->foreign('customer_group_id')->references('id')->on('customer_groups')->onDelete('cascade');
diff --git a/packages/Webkul/Customer/src/Repositories/CustomerGroupRepository.php b/packages/Webkul/Customer/src/Repositories/CustomerGroupRepository.php
new file mode 100644
index 000000000..2aa6489df
--- /dev/null
+++ b/packages/Webkul/Customer/src/Repositories/CustomerGroupRepository.php
@@ -0,0 +1,54 @@
+
+ * @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
+ */
+
+class CustomerGroupRepository extends Repository
+{
+ /**
+ * Specify Model class name
+ *
+ * @return mixed
+ */
+
+ function model()
+ {
+ return 'Webkul\Customer\Models\CustomersGroups';
+ }
+
+ /**
+ * @param array $data
+ * @return mixed
+ */
+
+ public function create(array $data)
+ {
+ $customer = $this->model->create($data);
+
+ return $customer;
+ }
+
+ /**
+ * @param array $data
+ * @param $id
+ * @param string $attribute
+ * @return mixed
+ */
+
+ public function update(array $data, $id, $attribute = "id")
+ {
+ $customer = $this->find($id);
+
+ $customer->update($data);
+
+ return $customer;
+ }
+}
\ No newline at end of file
diff --git a/packages/Webkul/Product/src/Product/Review.php b/packages/Webkul/Product/src/Product/Review.php
index 1b613dac6..d359d4729 100644
--- a/packages/Webkul/Product/src/Product/Review.php
+++ b/packages/Webkul/Product/src/Product/Review.php
@@ -78,12 +78,12 @@ class Review extends AbstractProduct
return $percentage;
}
- /**
- * Returns the of the product
- *
+ /**
+ * Returns the product accroding to paginate
+ *
* @param Product $product
- * @return integer
- */
+ * @return integer
+ */
public function loadMore($product)
{
diff --git a/packages/Webkul/Shipping/.gitignore b/packages/Webkul/Shipping/.gitignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/packages/Webkul/Shipping/composer.json b/packages/Webkul/Shipping/composer.json
new file mode 100644
index 000000000..7e3676e4f
--- /dev/null
+++ b/packages/Webkul/Shipping/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "webkul/laravel-shipping",
+ "description": "Shipping Package for Shipping Method",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "rahulshukla-webkul",
+ "email": "rahulshukla.symfony517@webkul.com"
+ }
+ ],
+ "require": {},
+ "autoload": {
+ "psr-4": {
+ "Webkul\\Shipping\\": "src/"
+ }
+ },
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Webkul\\Cart\\Providers\\ShippingServiceProvider"
+ ],
+ "aliases": {}
+ }
+ },
+ "minimum-stability": "dev"
+}
diff --git a/packages/Webkul/Shipping/src/Contracts/ShippingInterface.php b/packages/Webkul/Shipping/src/Contracts/ShippingInterface.php
new file mode 100644
index 000000000..aa2db0685
--- /dev/null
+++ b/packages/Webkul/Shipping/src/Contracts/ShippingInterface.php
@@ -0,0 +1,19 @@
+
+ */
+
+interface ShippingInterface
+{
+
+ public function calculate();
+
+
+}
+
+
+?>
\ No newline at end of file
diff --git a/packages/Webkul/Shipping/src/Helpers/Rate.php b/packages/Webkul/Shipping/src/Helpers/Rate.php
new file mode 100644
index 000000000..bdc4b9cda
--- /dev/null
+++ b/packages/Webkul/Shipping/src/Helpers/Rate.php
@@ -0,0 +1,21 @@
+aliasMiddleware('customer', RedirectIfNotCustomer::class);
+
+ $this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
+ }
+
+ /**
+ * Register services.
+ *
+ * @return void
+ */
+ public function register()
+ {
+
+ }
+}
diff --git a/packages/Webkul/Ui/src/Resources/views/datagrid/table/default.blade.php b/packages/Webkul/Ui/src/Resources/views/datagrid/table/default.blade.php
index fb97d7ea2..05417c7df 100644
--- a/packages/Webkul/Ui/src/Resources/views/datagrid/table/default.blade.php
+++ b/packages/Webkul/Ui/src/Resources/views/datagrid/table/default.blade.php
@@ -106,18 +106,13 @@
{!! $column->sorting() !!}
@endif
@endforeach
- Name
- {{-- @if(isset($attribute_columns))
+ @if(isset($attribute_columns))
@foreach($attribute_columns as $key => $value)
-
- {{ $value }}
+
+ {{ $value }}
@endforeach
- @endif --}}
+ @endif
Actions
@@ -136,12 +131,12 @@
@foreach ($columns as $column)
{!! $column->render($result) !!}
@endforeach
- {{-- @if(isset($attribute_columns))
+
+ @if(isset($attribute_columns))
@foreach ($attribute_columns as $atc)
{{ $result->{$atc} }}
@endforeach
- @endif --}}
-
+ @endif
@foreach($actions as $action)