Before merge with masteer
This commit is contained in:
parent
5fb2f78039
commit
11e7db8f85
|
|
@ -386,14 +386,27 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.sliders.index');
|
||||
|
||||
// Admin Store Front Settings Route
|
||||
Route::get('/slider/create','Webkul\Shop\Http\Controllers\SliderController@create')->defaults('_config',[
|
||||
|
||||
//slider create
|
||||
Route::get('slider/create','Webkul\Shop\Http\Controllers\SliderController@create')->defaults('_config',[
|
||||
'view' => 'admin::settings.sliders.create'
|
||||
])->name('admin.sliders.create');
|
||||
|
||||
Route::post('/slider/create','Webkul\Shop\Http\Controllers\SliderController@store')->defaults('_config',[
|
||||
Route::post('slider/create','Webkul\Shop\Http\Controllers\SliderController@store')->defaults('_config',[
|
||||
'redirect' => 'admin::sliders.index'
|
||||
])->name('admin.sliders.store');
|
||||
|
||||
//slider edit
|
||||
Route::get('slider/edit/{id}','Webkul\Shop\Http\Controllers\SliderController@edit')->defaults('_config',[
|
||||
'view' => 'admin::settings.sliders.edit'
|
||||
])->name('admin.sliders.edit');
|
||||
|
||||
Route::post('slider/edit/{id}','Webkul\Shop\Http\Controllers\SliderController@update')->defaults('_config',[
|
||||
'redirect' => 'admin::sliders.index'
|
||||
])->name('admin.sliders.update');
|
||||
|
||||
//destroy a slider item
|
||||
Route::get('slider/delete/{id}', 'Webkul\Shop\Http\Controllers\SliderController@destroy');
|
||||
|
||||
//tax routes
|
||||
Route::get('/tax-categories', 'Webkul\Tax\Http\Controllers\TaxController@index')->defaults('_config', [
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
@extends('admin::layouts.content')
|
||||
|
||||
@section('page_title')
|
||||
{{ __('admin::app.settings.sliders.add-title') }}
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
<div class="content">
|
||||
<form method="POST" action="{{ route('admin.sliders.update', $slider->id) }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.settings.sliders.add-title') }}</h1>
|
||||
</div>
|
||||
|
||||
<div class="page-action">
|
||||
<button type="submit" class="btn btn-lg btn-primary">
|
||||
{{ __('admin::app.settings.sliders.save-btn-title') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<div class="form-container">
|
||||
|
||||
@csrf()
|
||||
|
||||
<div class="control-group" :class="[errors.has('title') ? 'has-error' : '']">
|
||||
<label for="title">{{ __('admin::app.settings.sliders.title') }}</label>
|
||||
<input type="text" class="control" name="title" v-validate="'required'" value="{{ $slider->title ?: old('title') }}">
|
||||
<span class="control-error" v-if="errors.has('title')">@{{ errors.first('title') }}</span>
|
||||
</div>
|
||||
|
||||
<?php $channels = core()->getAllChannels() ?>
|
||||
<div class="control-group" :class="[errors.has('channel_id') ? 'has-error' : '']">
|
||||
<label for="channel_id">{{ __('admin::app.settings.sliders.channels') }}</label>
|
||||
<select class="control" id="channel_id" name="channel_id" value="" v-validate="'required'">
|
||||
@foreach($channels as $channel)
|
||||
<option value="{{ $channel->id }}" @if($channel->id == $slider->channel_id) selected @endif>
|
||||
{{ __($channel->name) }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('channel_id')">@{{ errors.first('channel_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('image') ? 'has-error' : '']">
|
||||
<label for="new_image">{{ __('admin::app.settings.sliders.image') }}</label>
|
||||
|
||||
<image-upload>
|
||||
<input type="file" class="control" id="add_image" name="image" value="" v-validate="'image|required'" placeholder="Upload Image" />
|
||||
|
||||
<span class="control-error" v-if="errors.has('image')">@{{ errors.first('image') }}</span>
|
||||
</image-upload>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('content') ? 'has-error' : '']">
|
||||
<label for="content">{{ __('admin::app.settings.sliders.content') }}</label>
|
||||
|
||||
<textarea class="control" id="add_content" name="content" v-validate="'required'" rows="5">{{ $slider->content ? : old('content') }}</textarea>
|
||||
|
||||
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -33,10 +33,22 @@ class SliderRepository extends Repository
|
|||
$image_name = uniqid(20).'.'.$image->getClientOriginalExtension();
|
||||
|
||||
$destinationPath = public_path('/vendor/webkul/shop/assets/images/slider');
|
||||
|
||||
$path = $image->move($destinationPath, $image_name);
|
||||
|
||||
$path= 'vendor/webkul/shop/assets/images/slider/'.$image_name;
|
||||
|
||||
$data['path'] = $path;
|
||||
|
||||
$this->model->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a slider item and delete the image from the disk or where ever it is
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function destroy($id) {
|
||||
return $this->model->destroy($id);
|
||||
}
|
||||
}
|
||||
|
|
@ -28,7 +28,6 @@ class AddressController extends Controller
|
|||
protected $customer;
|
||||
protected $address;
|
||||
|
||||
|
||||
public function __construct(CustomerRepository $customer, CustomerAddressRepository $address)
|
||||
{
|
||||
$this->middleware('customer');
|
||||
|
|
@ -41,22 +40,9 @@ class AddressController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Getting logged in
|
||||
* customer helper
|
||||
* @return Array
|
||||
*/
|
||||
private function getCustomer($id) {
|
||||
|
||||
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
|
||||
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getting logged in
|
||||
* customer address
|
||||
* helper
|
||||
* @return Array
|
||||
* Getting logged in customer address helper
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getAddress($id) {
|
||||
|
||||
|
|
@ -66,37 +52,32 @@ class AddressController extends Controller
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Address Route
|
||||
* index page
|
||||
* @return View
|
||||
* Address Route index page
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
public function index() {
|
||||
$id = auth()->guard('customer')->user()->id;
|
||||
|
||||
$customer = $this->getCustomer($id);
|
||||
|
||||
$address = $this->getAddress($id);
|
||||
|
||||
return view($this->_config['view'])->with('address', $address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the address
|
||||
* create form
|
||||
* @return View
|
||||
* Show the address create form
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
public function show() {
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new
|
||||
* address for
|
||||
* customer.
|
||||
* Create a new address for customer.
|
||||
*
|
||||
* @return View
|
||||
* @return view
|
||||
*/
|
||||
public function create() {
|
||||
|
||||
|
|
@ -144,11 +125,9 @@ class AddressController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* For editing the
|
||||
* existing address
|
||||
* of the customer
|
||||
* For editing the existing address of the customer
|
||||
*
|
||||
* @return View
|
||||
* @return view
|
||||
*/
|
||||
public function showEdit() {
|
||||
|
||||
|
|
@ -160,6 +139,12 @@ class AddressController extends Controller
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the premade resource of customer called
|
||||
* Address.
|
||||
*
|
||||
* @return redirect
|
||||
*/
|
||||
public function edit() {
|
||||
|
||||
$id = auth()->guard('customer')->user()->id;
|
||||
|
|
|
|||
|
|
@ -10,10 +10,7 @@ use Webkul\Customer\Models\Customer;
|
|||
use Auth;
|
||||
|
||||
/**
|
||||
* Customer controlller for the customer
|
||||
* basically for the tasks of customers
|
||||
* which will be done after customer
|
||||
* authenticastion.
|
||||
* Customer controlller for the customer basically for the tasks of customers which will be done after customer authentication.
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
|
|
@ -36,7 +33,7 @@ class CustomerController extends Controller
|
|||
protected $productReview;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
* Create a new Repository instance.
|
||||
*
|
||||
* @param Webkul\Product\Repositories\ProductReviewRepository $productReview
|
||||
* @return void
|
||||
|
|
@ -54,9 +51,8 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* For taking the customer
|
||||
* to the dashboard after
|
||||
* authentication
|
||||
* For taking the customer to the dashboard after authentication
|
||||
*
|
||||
* @return view
|
||||
*/
|
||||
private function getCustomer($id) {
|
||||
|
|
@ -65,9 +61,8 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Taking the customer
|
||||
* to profile details
|
||||
* page
|
||||
* Taking the customer to profile details page
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index() {
|
||||
|
|
@ -79,8 +74,7 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* For loading the
|
||||
* edit form page.
|
||||
* For loading the edit form page.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
|
|
@ -93,9 +87,7 @@ class CustomerController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Edit function
|
||||
* for editing customer
|
||||
* profile.
|
||||
* Edit function for editing customer profile.
|
||||
*
|
||||
* @return Redirect.
|
||||
*/
|
||||
|
|
@ -148,23 +140,40 @@ class CustomerController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the view for the customer account panel, showing orders in a table.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function orders() {
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the view for the customer account panel, showing wishlist items.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function wishlist() {
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the view for the customer account panel, showing approved reviews.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function reviews() {
|
||||
|
||||
$id = auth()->guard('customer')->user()->id;
|
||||
|
||||
$reviews = $this->productReview->getCustomerReview($id);
|
||||
$reviews = $this->productReview->getCustomerReview();
|
||||
|
||||
return view($this->_config['view'],compact('reviews'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the view for the customer account panel, shows the customer address.
|
||||
*
|
||||
* @return Mixed
|
||||
*/
|
||||
public function address() {
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Customer\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Webkul\Customer\Repositories\CustomerRepository;
|
||||
use Auth;
|
||||
|
||||
/**
|
||||
* Customer controlller for the customer
|
||||
* basically for the tasks of customers
|
||||
* which will be done after customer
|
||||
* authenticastion.
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class ReviewsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected $_config;
|
||||
protected $customer;
|
||||
|
||||
|
||||
public function __construct(CustomerRepository $customer)
|
||||
{
|
||||
$this->middleware('customer');
|
||||
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->customer = $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* For taking the customer
|
||||
* to the dashboard after
|
||||
* authentication
|
||||
* @return view
|
||||
*/
|
||||
private function getCustomer($id) {
|
||||
$customer = collect($this->customer->findOneWhere(['id'=>$id]));
|
||||
return $customer;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$id = auth()->guard('customer')->user()->id;
|
||||
|
||||
$customer = $this->getCustomer($id);
|
||||
|
||||
return view($this->_config['view'])->with('customer', $customer);
|
||||
}
|
||||
|
||||
public function reviews() {
|
||||
return view($this->_config['view']);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ use Webkul\Product\Repositories\ProductRepository;
|
|||
*/
|
||||
class ProductReviewRepository extends Repository
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* ProductImageRepository object
|
||||
*
|
||||
* @var array
|
||||
|
|
@ -51,9 +51,13 @@ class ProductReviewRepository extends Repository
|
|||
*
|
||||
* @param int $customerId
|
||||
*/
|
||||
function getCustomerReview($customerId)
|
||||
function getCustomerReview()
|
||||
{
|
||||
$reviews = $this->model->where('customer_id',$customerId)->with('product')->get();
|
||||
$customerId = auth()->guard('customer')->user()->id;
|
||||
|
||||
$reviews = $this->model->where(['customer_id'=> $customerId, 'status' => 'approved'])->with('product')->get();
|
||||
|
||||
// dd($reviews);
|
||||
|
||||
return $reviews;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ class ReviewController extends Controller
|
|||
*/
|
||||
public function __construct(Product $product, ProductReview $productReview)
|
||||
{
|
||||
$this->middleware('admin');
|
||||
|
||||
$this->middleware('customer')->only(['create', 'store']);
|
||||
|
||||
$this->product = $product;
|
||||
|
||||
$this->productReview = $productReview;
|
||||
|
|
@ -118,7 +122,7 @@ class ReviewController extends Controller
|
|||
return view($this->_config['view'],compact('product'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
|
|
@ -131,7 +135,7 @@ class ReviewController extends Controller
|
|||
return view($this->_config['view'],compact('review'));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
|
|
|
|||
|
|
@ -49,12 +49,59 @@ class SliderController extends controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates the new
|
||||
* sider item
|
||||
* Creates the new sider item.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function store() {
|
||||
|
||||
$this->slider->create(request()->all());
|
||||
|
||||
session()->flash('success', 'Slider created successfully.');
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the previously created slider item.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function edit($id) {
|
||||
$slider = $this->slider->find($id);
|
||||
|
||||
return view($this->_config['view'])->with('slider', $slider);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit the previously created slider item.
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function update($id) {
|
||||
if($this->slider->update(request()->all(), $id)) {
|
||||
session()->flash('success', 'Slider Item Successfully Updated');
|
||||
} else {
|
||||
session()->flash('error', 'Slider Cannot Be Updated');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a slider item and preserve the last one from deleting
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($id) {
|
||||
if($this->slider->findWhere(['channel_id' => core()->getCurrentChannel()->id])->count() == 1) {
|
||||
session()->flash('warning', 'Cannot Delete The Last Slider Item');
|
||||
} else {
|
||||
$this->slider->destroy($id);
|
||||
|
||||
session()->flash('success', 'Slider Item Successfully Deleted');
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
}
|
||||
|
|
@ -66,10 +66,6 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'customer.reviews.index'
|
||||
])->name('shop.reviews.store');
|
||||
|
||||
// Route::post('/reviews/create/{slug}', 'Webkul\Shop\Http\Controllers\ReviewController@store')->defaults('_config', [
|
||||
// 'redirect' => 'admin.reviews.index'
|
||||
// ])->name('admin.reviews.store');
|
||||
|
||||
// forgot Password Routes
|
||||
Route::get('/forgot-password', 'Webkul\Customer\Http\Controllers\ForgotPasswordController@create')->defaults('_config', [
|
||||
'view' => 'shop::customers.signup.forgot-password'
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<div class="account-items-list">
|
||||
|
||||
@if(is_null($reviews))
|
||||
@if(!is_null($reviews))
|
||||
@foreach($reviews as $review)
|
||||
<div class="account-item-card mt-15 mb-15">
|
||||
<div class="media-info">
|
||||
|
|
|
|||
|
|
@ -29,15 +29,23 @@
|
|||
mounted: function() {
|
||||
|
||||
this.sample = "";
|
||||
|
||||
var element = this.$el.getElementsByTagName("input")[0];
|
||||
|
||||
var this_this = this;
|
||||
|
||||
element.onchange = function() {
|
||||
var fReader = new FileReader();
|
||||
|
||||
fReader.readAsDataURL(element.files[0]);
|
||||
|
||||
fReader.onload = function(event) {
|
||||
this.img = document.getElementsByTagName("input")[0];
|
||||
|
||||
this.img.src = event.target.result;
|
||||
|
||||
this_this.newImage = this.img.src;
|
||||
|
||||
this_this.changePreview();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue