-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #185 from vishal-webkul/v1.3.0
Compatible with v1.3.0
- Loading branch information
Showing
44 changed files
with
907 additions
and
51 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"/js/app.js": "/js/app.js?id=0d10c953b55aa5b3686d", | ||
"/js/app.js": "/js/app.js?id=8c123f54f03db571ee75", | ||
"/css/pwa-admin.css": "/css/pwa-admin.css?id=7073d876ccd90f556cb1", | ||
"/css/pwa.css": "/css/pwa.css?id=985298ea84b30351141c" | ||
"/css/pwa.css": "/css/pwa.css?id=c95e523dd6940325d46a" | ||
} |
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,88 @@ | ||
<?php | ||
|
||
namespace Webkul\PWA\Http\Controllers\Shop; | ||
|
||
use Webkul\Customer\Repositories\CustomerAddressRepository; | ||
use Webkul\API\Http\Controllers\Shop\Controller; | ||
use Webkul\API\Http\Resources\Customer\CustomerAddress as CustomerAddressResource; | ||
|
||
class AddressController extends Controller | ||
{ | ||
/** | ||
* Contains current guard | ||
* | ||
* @var array | ||
*/ | ||
protected $guard; | ||
|
||
/** | ||
* Contains route related configuration | ||
* | ||
* @var array | ||
*/ | ||
protected $_config; | ||
|
||
/** | ||
* CustomerAddressRepository object | ||
* | ||
* @var \Webkul\Customer\Repositories\CustomerAddressRepository | ||
*/ | ||
protected $customerAddressRepository; | ||
|
||
/** | ||
* Controller instance | ||
* | ||
* @param Webkul\Customer\Repositories\CustomerAddressRepository $customerAddressRepository | ||
*/ | ||
public function __construct(CustomerAddressRepository $customerAddressRepository) | ||
{ | ||
$this->guard = request()->has('token') ? 'api' : 'customer'; | ||
|
||
auth()->setDefaultDriver($this->guard); | ||
|
||
// $this->middleware('auth:' . $this->guard); | ||
|
||
$this->_config = request('_config'); | ||
|
||
$this->customerAddressRepository = $customerAddressRepository; | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function store() | ||
{ | ||
$customer = auth($this->guard)->user(); | ||
|
||
if (request()->input('address1') && ! is_array(request()->input('address1'))) { | ||
return response()->json([ | ||
'message' => 'address1 must be an array.', | ||
]); | ||
} | ||
|
||
if (request()->input('address1')) { | ||
request()->merge([ | ||
'address1' => implode(PHP_EOL, array_filter(request()->input('address1'))), | ||
'customer_id' => $customer->id, | ||
]); | ||
} | ||
|
||
$this->validate(request(), [ | ||
'address1' => 'string|required', | ||
'country' => 'string|required', | ||
'state' => 'string|required', | ||
'city' => 'string|required', | ||
'postcode' => 'required', | ||
'phone' => 'required', | ||
]); | ||
|
||
$customerAddress = $this->customerAddressRepository->create(request()->all()); | ||
|
||
return response()->json([ | ||
'message' => 'Your address has been created successfully.', | ||
'data' => new CustomerAddressResource($customerAddress), | ||
]); | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
|
||
namespace Webkul\PWA\Http\Controllers\Shop; | ||
|
||
use Illuminate\Http\Request; | ||
use Webkul\API\Http\Controllers\Shop\Controller; | ||
use Webkul\Product\Repositories\SearchRepository; | ||
|
||
/** | ||
* Review controller | ||
* | ||
* @author Webkul Software Pvt. Ltd. <[email protected]> | ||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com) | ||
*/ | ||
class ImageSearchController extends Controller | ||
{ | ||
/** | ||
* SearchRepository object | ||
* | ||
* @var \Webkul\Core\Repositories\SearchRepository | ||
*/ | ||
protected $searchRepository; | ||
|
||
/** | ||
* Controller instance | ||
* | ||
* @param Webkul\Product\Repositories\SearchRepository $searchRepository | ||
*/ | ||
public function __construct(SearchRepository $searchRepository) | ||
{ | ||
$this->searchRepository = $searchRepository; | ||
} | ||
|
||
/** | ||
* Upload image for product search with machine learning | ||
* | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function upload() | ||
{ | ||
$url = $this->searchRepository->uploadSearchImage(request()->all()); | ||
|
||
return $url; | ||
} | ||
} |
Oops, something went wrong.