Merge branch 'master' of https://github.com/bagisto/bagisto into development
This commit is contained in:
commit
ea04a8c944
|
|
@ -107,15 +107,15 @@ class AddressController extends Controller
|
|||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$addresses = $this->customer->addresses;
|
||||
$address = $this->address->findOneWhere([
|
||||
'id' => $id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
foreach ($addresses as $address) {
|
||||
if ($id == $address->id) {
|
||||
return view($this->_config['view'], compact('address'));
|
||||
}
|
||||
}
|
||||
if (! $address)
|
||||
abort(404);
|
||||
|
||||
return redirect()->route('customer.address.index');
|
||||
return view($this->_config['view'], compact('address'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -142,7 +142,7 @@ class AddressController extends Controller
|
|||
$addresses = $this->customer->addresses;
|
||||
|
||||
foreach($addresses as $address) {
|
||||
if($id == $address->id) {
|
||||
if ($id == $address->id) {
|
||||
session()->flash('success', trans('shop::app.customer.account.address.edit.success'));
|
||||
|
||||
$this->address->update($data, $id);
|
||||
|
|
@ -185,17 +185,17 @@ class AddressController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$addresses = $this->customer->addresses;
|
||||
$address = $this->address->findOneWhere([
|
||||
'id' => $id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
foreach($addresses as $address) {
|
||||
if($id == $address->id) {
|
||||
$this->address->delete($id);
|
||||
if (! $address)
|
||||
abort(404);
|
||||
|
||||
session()->flash('success', trans('shop::app.customer.account.address.delete.success'));
|
||||
$this->address->delete($id);
|
||||
|
||||
return redirect()->route('customer.address.index');
|
||||
}
|
||||
}
|
||||
session()->flash('success', trans('shop::app.customer.account.address.delete.success'));
|
||||
|
||||
return redirect()->route('customer.address.index');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ class OrderDataGrid extends DataGrid
|
|||
public function prepareActions() {
|
||||
$this->addAction([
|
||||
'type' => 'View',
|
||||
'method' => 'GET',
|
||||
'route' => 'customer.orders.view',
|
||||
'icon' => 'icon eye-icon'
|
||||
]);
|
||||
|
|
|
|||
29
packages/Webkul/Customer/src/Http/Controllers/OrderController.php → packages/Webkul/Shop/src/Http/Controllers/OrderController.php
Executable file → Normal file
29
packages/Webkul/Customer/src/Http/Controllers/OrderController.php → packages/Webkul/Shop/src/Http/Controllers/OrderController.php
Executable file → Normal file
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Customer\Http\Controllers;
|
||||
namespace Webkul\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
|
@ -65,9 +65,10 @@ class OrderController extends Controller
|
|||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$orders = auth()->guard('customer')->user()->all_orders;
|
||||
public function index() {
|
||||
$orders = $this->order->findWhere([
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
return view($this->_config['view'], compact('orders'));
|
||||
}
|
||||
|
|
@ -80,17 +81,15 @@ class OrderController extends Controller
|
|||
*/
|
||||
public function view($id)
|
||||
{
|
||||
$orders = auth()->guard('customer')->user()->all_orders;
|
||||
$order = $this->order->findOneWhere([
|
||||
'customer_id' => auth()->guard('customer')->user()->id,
|
||||
'id' => $id
|
||||
]);
|
||||
|
||||
if (isset($orders) && count($orders)) {
|
||||
foreach ($orders as $order) {
|
||||
if ($order->id == $id) {
|
||||
return view($this->_config['view'], compact('order'));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $order)
|
||||
abort(404);
|
||||
|
||||
return redirect()->route( 'customer.orders.index');
|
||||
return view($this->_config['view'], compact('order'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -101,10 +100,10 @@ class OrderController extends Controller
|
|||
*/
|
||||
public function print($id)
|
||||
{
|
||||
$invoice = $this->invoice->find($id);
|
||||
$invoice = $this->invoice->findOrFail($id);
|
||||
|
||||
$pdf = PDF::loadView('shop::customers.account.orders.pdf', compact('invoice'))->setPaper('a4');
|
||||
|
||||
return $pdf->download('invoice-' . $invoice->created_at->format('d-m-Y') . '.pdf');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -119,19 +119,17 @@ class ReviewController extends Controller
|
|||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$reviews = auth()->guard('customer')->user()->all_reviews;
|
||||
$review = $this->productReview->findOneWhere([
|
||||
'id' => $id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
|
||||
if ($reviews->count() > 0) {
|
||||
foreach ($reviews as $review) {
|
||||
if ($review->id == $id) {
|
||||
$this->productReview->delete($id);
|
||||
if (! $review)
|
||||
abort(404);
|
||||
|
||||
session()->flash('success', trans('shop::app.response.delete-success', ['name' => 'Product Review']));
|
||||
$this->productReview->delete($id);
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
}
|
||||
}
|
||||
session()->flash('success', trans('shop::app.response.delete-success', ['name' => 'Product Review']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,13 +15,17 @@ class Theme
|
|||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$theme = app('themes');
|
||||
$themes = app('themes');
|
||||
$channel = core()->getCurrentChannel();
|
||||
|
||||
if ($channel && $channelThemeCode = $channel->theme) {
|
||||
if ($theme->exists($channelThemeCode)) {
|
||||
$theme->set($channelThemeCode);
|
||||
if ($themes->exists($channelThemeCode)) {
|
||||
$themes->set($channelThemeCode);
|
||||
} else {
|
||||
$themes->set(config('themes.default'));
|
||||
}
|
||||
} else {
|
||||
$themes->set(config('themes.default'));
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
|||
|
|
@ -241,17 +241,17 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
|
||||
/* Orders route */
|
||||
//Customer orders(listing)
|
||||
Route::get('orders', 'Webkul\Customer\Http\Controllers\OrderController@index')->defaults('_config', [
|
||||
Route::get('orders', 'Webkul\Shop\Http\Controllers\OrderController@index')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.orders.index'
|
||||
])->name('customer.orders.index');
|
||||
|
||||
//Customer orders view summary and status
|
||||
Route::get('orders/view/{id}', 'Webkul\Customer\Http\Controllers\OrderController@view')->defaults('_config', [
|
||||
Route::get('orders/view/{id}', 'Webkul\Shop\Http\Controllers\OrderController@view')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.orders.view'
|
||||
])->name('customer.orders.view');
|
||||
|
||||
//Prints invoice
|
||||
Route::get('orders/print/{id}', 'Webkul\Customer\Http\Controllers\OrderController@print')->defaults('_config', [
|
||||
Route::get('orders/print/{id}', 'Webkul\Shop\Http\Controllers\OrderController@print')->defaults('_config', [
|
||||
'view' => 'shop::customers.account.orders.print'
|
||||
])->name('customer.orders.print');
|
||||
|
||||
|
|
|
|||
|
|
@ -53,12 +53,6 @@ class ShopServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
$themes = $this->app->make('themes');
|
||||
|
||||
if (! $themes->current() && \Config::get('themes.default')) {
|
||||
$themes->set(\Config::get('themes.default'));
|
||||
}
|
||||
|
||||
$this->registerConfig();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@ class ThemeViewFinder extends FileViewFinder
|
|||
// Extract the $view and the $namespace parts
|
||||
list($namespace, $view) = $this->parseNamespaceSegments($name);
|
||||
|
||||
$paths = $this->addThemeNamespacePaths($namespace);
|
||||
if ($namespace != 'admin') {
|
||||
$paths = $this->addThemeNamespacePaths($namespace);
|
||||
|
||||
// Find and return the view
|
||||
return $this->findInPaths($view, $paths);
|
||||
// Find and return the view
|
||||
return $this->findInPaths($view, $paths);
|
||||
} else {
|
||||
return $this->findInPaths($view, $this->hints[$namespace]);
|
||||
}
|
||||
}
|
||||
|
||||
public function addThemeNamespacePaths($namespace)
|
||||
|
|
|
|||
Loading…
Reference in New Issue