Slider Configuration in works ready to save slider images in next commit
This commit is contained in:
parent
5578733ecd
commit
7c5253aec2
|
|
@ -11,6 +11,7 @@
|
|||
"php": "^7.1.3",
|
||||
"dimsav/laravel-translatable": "^9.0",
|
||||
"fideloper/proxy": "^4.0",
|
||||
"intervention/image": "^2.4",
|
||||
"kalnoy/nestedset": "^4.3",
|
||||
"laravel/framework": "5.6.*",
|
||||
"laravel/tinker": "^1.0",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "daaa24e649dd4e9808feef8251e43247",
|
||||
"content-hash": "8acd4eec85be1351459a67cfd14d039b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "commerceguys/intl",
|
||||
|
|
@ -465,6 +465,141 @@
|
|||
],
|
||||
"time": "2018-02-07T20:20:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
"version": "1.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/psr7.git",
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4.0",
|
||||
"psr/http-message": "~1.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/http-message-implementation": "1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.4-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"GuzzleHttp\\Psr7\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Dowling",
|
||||
"email": "mtdowling@gmail.com",
|
||||
"homepage": "https://github.com/mtdowling"
|
||||
},
|
||||
{
|
||||
"name": "Tobias Schultze",
|
||||
"homepage": "https://github.com/Tobion"
|
||||
}
|
||||
],
|
||||
"description": "PSR-7 message implementation that also provides common utility methods",
|
||||
"keywords": [
|
||||
"http",
|
||||
"message",
|
||||
"request",
|
||||
"response",
|
||||
"stream",
|
||||
"uri",
|
||||
"url"
|
||||
],
|
||||
"time": "2017-03-20T17:10:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "intervention/image",
|
||||
"version": "2.4.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Intervention/image.git",
|
||||
"reference": "e82d274f786e3d4b866a59b173f42e716f0783eb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Intervention/image/zipball/e82d274f786e3d4b866a59b173f42e716f0783eb",
|
||||
"reference": "e82d274f786e3d4b866a59b173f42e716f0783eb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"guzzlehttp/psr7": "~1.1",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9.2",
|
||||
"phpunit/phpunit": "^4.8 || ^5.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-gd": "to use GD library based image processing.",
|
||||
"ext-imagick": "to use Imagick based image processing.",
|
||||
"intervention/imagecache": "Caching extension for the Intervention Image library"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.4-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Intervention\\Image\\ImageServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Image": "Intervention\\Image\\Facades\\Image"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Intervention\\Image\\": "src/Intervention/Image"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Oliver Vogel",
|
||||
"email": "oliver@olivervogel.com",
|
||||
"homepage": "http://olivervogel.com/"
|
||||
}
|
||||
],
|
||||
"description": "Image handling and manipulation library with support for Laravel integration",
|
||||
"homepage": "http://image.intervention.io/",
|
||||
"keywords": [
|
||||
"gd",
|
||||
"image",
|
||||
"imagick",
|
||||
"laravel",
|
||||
"thumbnail",
|
||||
"watermark"
|
||||
],
|
||||
"time": "2018-05-29T14:19:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jakub-onderka/php-console-color",
|
||||
"version": "0.1",
|
||||
|
|
@ -1371,6 +1506,56 @@
|
|||
],
|
||||
"time": "2017-02-14T16:28:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/http-message",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/http-message.git",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Http\\Message\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for HTTP messages",
|
||||
"homepage": "https://github.com/php-fig/http-message",
|
||||
"keywords": [
|
||||
"http",
|
||||
"http-message",
|
||||
"psr",
|
||||
"psr-7",
|
||||
"request",
|
||||
"response"
|
||||
],
|
||||
"time": "2016-08-06T14:39:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
|
|
|
|||
|
|
@ -170,6 +170,9 @@ return [
|
|||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
//Laravel Intervention
|
||||
Intervention\Image\ImageServiceProvider::class,
|
||||
|
||||
//Webkul packages
|
||||
Webkul\User\Providers\UserServiceProvider::class,
|
||||
Webkul\Admin\Providers\AdminServiceProvider::class,
|
||||
|
|
@ -232,7 +235,8 @@ return [
|
|||
'URL' => Illuminate\Support\Facades\URL::class,
|
||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class
|
||||
'Datagrid' => Webkul\Ui\DataGrid\Facades\DataGrid::class,
|
||||
'Image' => Intervention\Image\Facades\Image::class
|
||||
],
|
||||
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Image Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Intervention Image supports "GD Library" and "Imagick" to process images
|
||||
| internally. You may choose one of them according to your PHP
|
||||
| configuration. By default PHP's "GD Library" implementation is used.
|
||||
|
|
||||
| Supported: "gd", "imagick"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'gd'
|
||||
|
||||
];
|
||||
|
|
@ -44,6 +44,11 @@ class UserComposer
|
|||
'column' => 'u.id',
|
||||
'type' => 'number',
|
||||
'label' => 'Admin ID'
|
||||
],
|
||||
[
|
||||
'column' => 'r.id',
|
||||
'type' => 'number',
|
||||
'label' => 'Role ID'
|
||||
]
|
||||
],
|
||||
'searchable' => [
|
||||
|
|
@ -77,13 +82,13 @@ class UserComposer
|
|||
// ],
|
||||
],
|
||||
'join' => [
|
||||
// [
|
||||
// 'join' => 'leftjoin',
|
||||
// 'table' => 'roles as r',
|
||||
// 'primaryKey' => 'u.role_id',
|
||||
// 'condition' => '=',
|
||||
// 'secondaryKey' => 'r.id',
|
||||
// ]
|
||||
[
|
||||
'join' => 'leftjoin',
|
||||
'table' => 'roles as r',
|
||||
'primaryKey' => 'u.role_id',
|
||||
'condition' => '=',
|
||||
'secondaryKey' => 'r.id',
|
||||
]
|
||||
],
|
||||
'columns' => [
|
||||
[
|
||||
|
|
@ -104,12 +109,18 @@ class UserComposer
|
|||
'label' => 'Admin E-Mail',
|
||||
'sortable' => true,
|
||||
],
|
||||
// [
|
||||
// 'name' => 'r.name as rolename',
|
||||
// 'type' => 'string',
|
||||
// 'label' => 'Role Name',
|
||||
// 'sortable' => true,
|
||||
// ],
|
||||
[
|
||||
'name' => 'r.name',
|
||||
'type' => 'string',
|
||||
'label' => 'Role Name',
|
||||
'sortable' => true,
|
||||
],
|
||||
[
|
||||
'name' => 'r.id as ds',
|
||||
'type' => 'string',
|
||||
'label' => 'Role ID',
|
||||
'sortable' => true,
|
||||
],
|
||||
// [
|
||||
// 'name' => 'a.first_name',
|
||||
// 'type' => 'string',
|
||||
|
|
|
|||
|
|
@ -299,6 +299,15 @@ Route::group(['middleware' => ['web']], function () {
|
|||
])->name('admin.account.edit');
|
||||
|
||||
Route::put('/account', 'Webkul\User\Http\Controllers\AccountController@update')->name('admin.account.update');
|
||||
|
||||
// Admin Store Front Settings Route
|
||||
Route::get('/slider/create','Webkul\Shop\Http\Controllers\SliderController@index')->defaults('_config',[
|
||||
'view' => 'admin::sliders.create'
|
||||
])->name('admin.sliders.index');
|
||||
|
||||
Route::post('/slider/create','Webkul\Shop\Http\Controllers\SliderController@create')->defaults('_config',[
|
||||
'redirect' => 'admin::sliders.create'
|
||||
])->name('admin.sliders.create');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ class EventServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function createAdminMenu()
|
||||
{
|
||||
Event::listen('admin.menu.create', function() {
|
||||
return Menu::create(function($menu) {
|
||||
Event::listen('admin.menu.create', function () {
|
||||
return Menu::create(function ($menu) {
|
||||
Event::fire('admin.menu.build', $menu);
|
||||
});
|
||||
});
|
||||
|
||||
Event::listen('admin.menu.build', function($menu) {
|
||||
Event::listen('admin.menu.build', function ($menu) {
|
||||
$menu->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1, 'dashboard-icon');
|
||||
|
||||
$menu->add('catalog', 'Catalog', 'admin.catalog.products.index', 3, 'catalog-icon');
|
||||
|
|
@ -75,6 +75,8 @@ class EventServiceProvider extends ServiceProvider
|
|||
$menu->add('settings.users.users', 'Users', 'admin.users.index', 1, '');
|
||||
|
||||
$menu->add('settings.users.roles', 'Roles', 'admin.roles.index', 2, '');
|
||||
|
||||
$menu->add('settings.sliders', 'Create Sliders', 'admin.sliders.index', 8, '');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +87,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function buildACL()
|
||||
{
|
||||
Event::listen('admin.acl.build', function($acl) {
|
||||
Event::listen('admin.acl.build', function ($acl) {
|
||||
$acl->add('dashboard', 'Dashboard', 'admin.dashboard.index', 1);
|
||||
|
||||
$acl->add('configuration', 'Configure', 'admin.account.edit', 5);
|
||||
|
|
@ -107,7 +109,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function registerACL()
|
||||
{
|
||||
$this->app->singleton('acl', function() {
|
||||
$this->app->singleton('acl', function () {
|
||||
return current(Event::fire('admin.acl.create'));
|
||||
});
|
||||
|
||||
|
|
@ -121,13 +123,13 @@ class EventServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function createProductFormAccordian()
|
||||
{
|
||||
Event::listen('admin.catalog.products.accordian.create', function() {
|
||||
return ProductFormAccordian::create(function($accordian) {
|
||||
Event::listen('admin.catalog.products.accordian.create', function () {
|
||||
return ProductFormAccordian::create(function ($accordian) {
|
||||
Event::fire('admin.catalog.products.accordian.build', $accordian);
|
||||
});
|
||||
});
|
||||
|
||||
Event::listen('admin.catalog.products.accordian.build', function($accordian) {
|
||||
Event::listen('admin.catalog.products.accordian.build', function ($accordian) {
|
||||
$accordian->add('categories', 'Categories', 'admin::catalog.products.accordians.categories', 1);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,6 +235,16 @@ return [
|
|||
'default-locale' => 'Default Locale',
|
||||
'currencies' => 'Currencies',
|
||||
'base-currency' => 'Base Currency'
|
||||
]
|
||||
],
|
||||
|
||||
'sliders' => [
|
||||
'title' => 'Title',
|
||||
'add-title' => 'Create Slider',
|
||||
'save-btn-title' => 'Save Slider',
|
||||
'general' => 'General',
|
||||
'image' => 'Image',
|
||||
'content' => 'Content',
|
||||
'channels' => 'Channel'
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
@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.create') }}" @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()
|
||||
<accordian :title="'{{ __('admin::app.settings.sliders.general') }}'" :active="true">
|
||||
<div slot="body">
|
||||
|
||||
<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'">
|
||||
<span class="control-error" v-if="errors.has('title')">@{{ errors.first('title') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
|
||||
<label for="channel">{{ __('admin::app.settings.sliders.channels') }}</label>
|
||||
<select class="control" id="channel" name="channel" value="" v-validate="'required'">
|
||||
@foreach($channels[0] as $channel)
|
||||
<option value="{{ $channel->id }}">{{ __($channel->name) }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('channel')">@{{ errors.first('channel') }}</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 from Outer"/>
|
||||
|
||||
<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"></textarea>
|
||||
|
||||
<span class="control-error" v-if="errors.has('content')">@{{ errors.first('content') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</accordian>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateSlidersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sliders', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title');
|
||||
$table->string('path');
|
||||
$table->string('content');
|
||||
$table->integer('channel_id')->unsigned();
|
||||
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::disableForeignKeyConstraints();
|
||||
Schema::dropIfExists('sliders');
|
||||
Schema::enableForeignKeyConstraints();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Slider extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'tile', 'path','content','channel_id'
|
||||
];
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Core\Repositories;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
|
||||
/**
|
||||
* Country Reposotory
|
||||
*
|
||||
* @author Jitendra Singh <jitendra@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
class SliderRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function model()
|
||||
{
|
||||
return 'Webkul\Core\Models\Slider';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace Webkul\Shop\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Webkul\Channel\Channel;
|
||||
use Webkul\Core\Repositories\SliderRepository as Slider;
|
||||
|
||||
/**
|
||||
* Slider controller
|
||||
*
|
||||
* @author Prashant Singh <prashant.singh852@webkul.com>
|
||||
* @copyright 2018 Webkul Software Pvt Ltd (http://www.webkul.com)
|
||||
*/
|
||||
|
||||
class SliderController extends controller
|
||||
{
|
||||
protected $_config;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_config = request('_config');
|
||||
|
||||
}
|
||||
|
||||
public function index(){
|
||||
$call = new Channel();
|
||||
$channels = $call->getChannelWithLocales();
|
||||
return view($this->_config['view'])->with('channels',[$channels]);
|
||||
}
|
||||
|
||||
public function create(Request $request) {
|
||||
$this->validate($request,[
|
||||
'title' => 'string|required|max:100',
|
||||
'image' => 'required|image|mimes:png,jpg',
|
||||
// |dimensions:ratio=12/5
|
||||
'content' => 'string'
|
||||
]);
|
||||
|
||||
$image = $request->file('image');
|
||||
$input['imagename'] = time().'.'.$image->getClientOriginalExtension();
|
||||
$destinationPath = public_path('/images');
|
||||
$image->move($destinationPath, $input['imagename']);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -668,11 +668,13 @@ class DataGrid
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($alias_proper_secondary) {
|
||||
$this->getQueryWithJoin();
|
||||
} else {
|
||||
throw new \Exception('Due to a bug in laravel, you can\'t use secondary table columns without aliasing');
|
||||
}
|
||||
$this->getQueryWithJoin();
|
||||
|
||||
// if ($alias_proper_secondary) {
|
||||
// $this->getQueryWithJoin();
|
||||
// } else {
|
||||
// throw new \Exception('Due to a bug in laravel, you can\'t use secondary table columns without aliasing');
|
||||
// }
|
||||
} else {
|
||||
throw new \Exception('Aliases of Join table and the secondary key columns do not match');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,3 +6,4 @@ Vue.component("tree-item", require("./components/tree-view/tree-item"));
|
|||
Vue.component("tree-checkbox", require("./components/tree-view/tree-checkbox"));
|
||||
Vue.component("tree-radio", require("./components/tree-view/tree-radio"));
|
||||
Vue.component("modal", require("./components/modal"));
|
||||
Vue.component("image-upload", require("./components/image/image-upload-single"));
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<i class="icon" :class="iconClass"></i>
|
||||
</slot>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="accordian-content">
|
||||
<slot name="body">
|
||||
</slot>
|
||||
|
|
@ -24,7 +24,8 @@
|
|||
|
||||
data: function() {
|
||||
return {
|
||||
isActive: false
|
||||
isActive: false,
|
||||
imageData: '',
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
<template>
|
||||
<div class="preview-image">
|
||||
<slot>
|
||||
|
||||
</slot>
|
||||
|
||||
<div class="preview-wrapper">
|
||||
<img class="image-preview" :src="sample"/>
|
||||
</div>
|
||||
|
||||
<div class="remove-preview">
|
||||
<button class="btn btn-md btn-primary" @click.prevent="removePreviewImage">Remove Image</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default{
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
sample: "",
|
||||
image_file: "",
|
||||
file: null,
|
||||
newImage:"",
|
||||
};
|
||||
},
|
||||
|
||||
mounted: function() {
|
||||
|
||||
this.sample = "http://www.etaletaculture.fr/wp-content/uploads/2012/10/lorem-ipsum.jpg";
|
||||
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();
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
removePreviewImage: function() {
|
||||
this.sample = "";
|
||||
},
|
||||
|
||||
changePreview: function(){
|
||||
this.sample = this.newImage;
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
getInputImage() {
|
||||
console.log(this.imageData);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.preview-wrapper{
|
||||
height:200px;
|
||||
width:200px;
|
||||
padding:5px;
|
||||
}
|
||||
.image-preview{
|
||||
height:190px;
|
||||
width:190px;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue