Issues #175, #176 fixed and added bootstrap.js in main js file

This commit is contained in:
jitendra 2018-11-28 10:56:54 +05:30
parent e416b97e84
commit fafbcb432b
11 changed files with 137 additions and 6 deletions

View File

@ -1,3 +1,4 @@
require("./bootstrap");
window.jQuery = window.$ = $ = require("jquery");
window.Vue = require("vue");
window.VeeValidate = require("vee-validate");

View File

@ -0,0 +1,56 @@
window._ = require('lodash');
window.Popper = require('popper.js').default;
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo'
// window.Pusher = require('pusher-js');
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: process.env.MIX_PUSHER_APP_KEY,
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
// encrypted: true
// });

View File

@ -132,9 +132,13 @@ class AttributeController extends Controller
if(!$attribute->is_user_defined) {
session()->flash('error', 'Can not delete system attribute.');
} else {
$this->attribute->delete($id);
try {
$this->attribute->delete($id);
session()->flash('success', 'Attribute deleted successfully.');
session()->flash('success', 'Attribute deleted successfully.');
} catch(\Exception $e) {
session()->flash('error', 'Attribute is used in configurable products.');
}
}
return redirect()->back();

View File

@ -135,8 +135,12 @@ class AttributeFamilyController extends Controller
*/
public function destroy($id)
{
$attributeFamily = $this->attributeFamily->find($id);
if($this->attributeFamily->count() == 1) {
session()->flash('error', 'At least one family is required.');
} else if ($attributeFamily->products()->count()) {
session()->flash('error', 'Attribute family is used in products.');
} else {
$this->attributeFamily->delete($id);

View File

@ -4,6 +4,7 @@ namespace Webkul\Attribute\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Attribute\Models\AttributeGroup;
use Webkul\Product\Models\Product;
class AttributeFamily extends Model
{
@ -46,4 +47,12 @@ class AttributeFamily extends Model
{
return $this->custom_attributes()->where('attributes.is_configurable', 1)->where('attributes.type', 'select')->get();
}
/**
* Get all of the products.
*/
public function products()
{
return $this->hasMany(Product::class);
}
}

View File

@ -72,7 +72,7 @@ class CurrencyController extends Controller
public function store(Request $request)
{
$this->validate(request(), [
'code' => 'required|unique:countries,code',
'code' => 'required|unique:currencies,code',
'name' => 'required'
]);

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{
"/js/shop.js": "/js/shop.js?id=a656d2dc590579ec4167",
"/js/shop.js": "/js/shop.js?id=31a19d51860e4d8549a1",
"/css/shop.css": "/css/shop.css?id=8ebbcbb5472191aa17e5"
}

View File

@ -147,7 +147,7 @@ Route::group(['middleware' => ['web', 'theme', 'locale', 'currency']], function
//registration form store
Route::post('register', 'Webkul\Customer\Http\Controllers\RegistrationController@create')->defaults('_config', [
'redirect' => 'customer.account.index',
'redirect' => 'customer.session.index',
])->name('customer.register.create');
// Auth Routes

View File

@ -1,3 +1,4 @@
require("./bootstrap");
window.jQuery = window.$ = $ = require("jquery");
window.Vue = require("vue");
window.VeeValidate = require("vee-validate");

View File

@ -0,0 +1,56 @@
window._ = require('lodash');
window.Popper = require('popper.js').default;
/**
* We'll load jQuery and the Bootstrap jQuery plugin which provides support
* for JavaScript based Bootstrap features such as modals and tabs. This
* code may be modified to fit the specific needs of your application.
*/
try {
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
/**
* Next we will register the CSRF Token as a common header with Axios so that
* all outgoing HTTP requests automatically have it attached. This is just
* a simple convenience so we don't have to attach every token manually.
*/
let token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
/**
* Echo exposes an expressive API for subscribing to channels and listening
* for events that are broadcast by Laravel. Echo and event broadcasting
* allows your team to easily build robust real-time web applications.
*/
// import Echo from 'laravel-echo'
// window.Pusher = require('pusher-js');
// window.Echo = new Echo({
// broadcaster: 'pusher',
// key: process.env.MIX_PUSHER_APP_KEY,
// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
// encrypted: true
// });