Skip to content

Commit

Permalink
Merge pull request #167 from avored/dev
Browse files Browse the repository at this point in the history
merging dev to master
  • Loading branch information
indpurvesh authored Jun 21, 2018
2 parents b1808c9 + bb02e05 commit 5a830dd
Show file tree
Hide file tree
Showing 37 changed files with 3,810 additions and 103 deletions.
23 changes: 23 additions & 0 deletions app/Http/Controllers/OrderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,29 @@
use AvoRed\Ecommerce\Models\Database\User;
use AvoRed\Ecommerce\Models\Database\Address;
use AvoRed\Framework\Models\Database\OrderProductVariation;
use Illuminate\Support\Facades\Session;
use AvoRed\Framework\Models\Contracts\ConfigurationInterface;

class OrderController extends Controller
{


/**
*
* @var \AvoRed\Framework\Models\Repository\ConfigurationRepository
*/
protected $repository;

/**
* Construct to setup Repository
*
*/
public function __construct(ConfigurationInterface $rep)
{
$this->repository = $rep;
}


public function place(PlaceOrderRequest $request)
{
$orderProductData = Cart::all();
Expand All @@ -27,12 +47,15 @@ public function place(PlaceOrderRequest $request)
$orderStatus = OrderStatus::whereIsDefault(1)->get()->first();
$paymentOption = $request->get('payment_option');

$currencyCode = Session::get('currency_code') ?? $this->repository->getValueByKey('general_site_currency');

$data['shipping_address_id'] = $shippingAddress->id;
$data['billing_address_id'] = $billingAddress->id;
$data['user_id'] = $user->id;
$data['shipping_option'] = $request->get('shipping_option');
$data['payment_option'] = $paymentOption;
$data['order_status_id'] = $orderStatus->id;
$data['currency_code'] = $currencyCode;

$payment = Payment::get($paymentOption);

Expand Down
17 changes: 14 additions & 3 deletions app/Http/ViewComposers/LayoutAppComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\ViewComposers;

use AvoRed\Ecommerce\Models\Database\Menu;
use AvoRed\Framework\Models\Database\Configuration;
use Illuminate\View\View;
use Illuminate\Support\Facades\Session;
use AvoRed\Ecommerce\Models\Contracts\MenuInterface;
use AvoRed\Ecommerce\Models\Contracts\SiteCurrencyInterface;

class LayoutAppComposer
{
Expand All @@ -16,9 +16,18 @@ class LayoutAppComposer
*/
protected $repository;

public function __construct(MenuInterface $repository)
{
/**
*
* @var \AvoRed\Ecommerce\Models\Repository\SiteCurrencyRepository
*/
protected $siteCurrencyRepository;

public function __construct(
MenuInterface $repository,
SiteCurrencyInterface $currencyRepository
) {
$this->repository = $repository;
$this->siteCurrencyRepository = $currencyRepository;
}

/**
Expand All @@ -32,12 +41,14 @@ public function compose(View $view)
$cart = (null === Session::get('cart')) ? 0 : count(Session::get('cart'));

$menus = $this->repository->parentsAll();
$currencies = $this->siteCurrencyRepository->options();

$metaTitle = Configuration::getConfiguration('general_site_title');
$metaDescription = Configuration::getConfiguration('general_site_description');

$view->with('menus', $menus)
->with('cart', $cart)
->with('currencies', $currencies)
->with('metaTitle', $metaTitle)
->with('metaDescription', $metaDescription);
}
Expand Down
13 changes: 3 additions & 10 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use AvoRed\Framework\Menu\Facade as MenuFacade;
use AvoRed\Framework\Menu\Menu;


class AppServiceProvider extends ServiceProvider
{
/**
Expand All @@ -34,31 +33,27 @@ public function register()
//
}



/**
* Register the Menus.
*
* @return void
*/
protected function registerFrontMenu()
{
MenuFacade::make('my-account',function (Menu $accountMenu){
MenuFacade::make('my-account', function (Menu $accountMenu) {
$accountMenu->label('My Account')
->route('my-account.home');
});

MenuFacade::make('cart',function (Menu $accountMenu){
MenuFacade::make('cart', function (Menu $accountMenu) {
$accountMenu->label('Cart')
->route('cart.view');
});


MenuFacade::make('checkout',function (Menu $accountMenu){
MenuFacade::make('checkout', function (Menu $accountMenu) {
$accountMenu->label('Checkout')
->route('checkout.index');
});

}

/**
Expand All @@ -71,7 +66,5 @@ public function registerViewComposerData()
View::composer('checkout.index', CheckoutComposer::class);
View::composer('user.my-account.sidebar', MyAccountSidebarComposer::class);
View::composer('layouts.app', LayoutAppComposer::class);

}

}
2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function map()
*/
protected function mapWebRoutes()
{
Route::middleware('web')
Route::middleware(['web','currency'])
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"avored/cash-on-delivery": "~1.2",
"avored/contact": "~1.2",
"avored/dummy-data": "~1.4",
"avored/ecommerce": "~1.6",
"avored/ecommerce": "~1.8",
"avored/featured": "~1.7",
"avored/fixed-rate": "~1.5",
"avored/module-installer": "1.*",
Expand Down
Loading

0 comments on commit 5a830dd

Please sign in to comment.