remove channel from tax category

This commit is contained in:
Annika Wolff 2020-04-16 10:25:45 +02:00
parent 88ce2bd320
commit 7a9f099b7b
7 changed files with 39 additions and 39 deletions

View File

@ -26,22 +26,6 @@
<div class="form-container"> <div class="form-container">
@csrf() @csrf()
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.configuration.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach (core()->getAllChannels() as $channelModel)
<option value="{{ $channelModel->id }}">
{{ $channelModel->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('code') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.configuration.tax-categories.code') }}</label> <label for="code" class="required">{{ __('admin::app.configuration.tax-categories.code') }}</label>
@ -67,7 +51,7 @@
</div> </div>
<?php $selectedOptions = old('taxrates') ?: [] ?> <?php $selectedOptions = old('taxrates') ?: [] ?>
<div class="control-group" :class="[errors.has('taxrates[]') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('taxrates[]') ? 'has-error' : '']">
<label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label> <label for="taxrates" class="required">{{ __('admin::app.configuration.tax-categories.select-taxrates') }}</label>

View File

@ -27,22 +27,6 @@
<div class="form-container"> <div class="form-container">
@csrf() @csrf()
@method('PUT') @method('PUT')
<div class="control-group" :class="[errors.has('channel') ? 'has-error' : '']">
<label for="channel" class="required">{{ __('admin::app.settings.tax-categories.select-channel') }}</label>
<select class="control" name="channel_id">
@foreach (core()->getAllChannels() as $channelModel)
<option @if ($taxCategory->channel_id == $channelModel->id) selected @endif value="{{ $channelModel->id }}">
{{ $channelModel->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('code') ? 'has-error' : '']"> <div class="control-group" :class="[errors.has('code') ? 'has-error' : '']">
<label for="code" class="required">{{ __('admin::app.settings.tax-categories.code') }}</label> <label for="code" class="required">{{ __('admin::app.settings.tax-categories.code') }}</label>

View File

@ -7,9 +7,6 @@ use Webkul\Tax\Models\TaxCategory;
$factory->define(TaxCategory::class, function (Faker $faker) { $factory->define(TaxCategory::class, function (Faker $faker) {
return [ return [
'channel_id' => function () {
return core()->getCurrentChannel()->id;
},
'code' => $faker->uuid, 'code' => $faker->uuid,
'name' => $faker->words(2, true), 'name' => $faker->words(2, true),
'description' => $faker->sentence(10), 'description' => $faker->sentence(10),

View File

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class RemoveChannelFromTaxCategory extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('tax_categories', function (Blueprint $table) {
$table->dropForeign('tax_categories_channel_id_foreign');
$table->dropColumn('channel_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tax_categories', function (Blueprint $table) {
$table->integer('channel_id')->unsigned()->after('id');
$table->foreign('channel_id')->references('id')->on('channels')->onDelete('cascade');
});
}
}

View File

@ -68,7 +68,6 @@ class TaxCategoryController extends Controller
$data = request()->input(); $data = request()->input();
$this->validate(request(), [ $this->validate(request(), [
'channel_id' => 'required|numeric',
'code' => 'required|string|unique:tax_categories,code', 'code' => 'required|string|unique:tax_categories,code',
'name' => 'required|string', 'name' => 'required|string',
'description' => 'required|string', 'description' => 'required|string',
@ -111,7 +110,6 @@ class TaxCategoryController extends Controller
public function update($id) public function update($id)
{ {
$this->validate(request(), [ $this->validate(request(), [
'channel_id' => 'required|numeric',
'code' => 'required|string|unique:tax_categories,code,' . $id, 'code' => 'required|string|unique:tax_categories,code,' . $id,
'name' => 'required|string', 'name' => 'required|string',
'description' => 'required|string', 'description' => 'required|string',

View File

@ -16,7 +16,6 @@ class TaxCategory extends Model implements TaxCategoryContract
protected $table = 'tax_categories'; protected $table = 'tax_categories';
protected $fillable = [ protected $fillable = [
'channel_id',
'code', 'code',
'name', 'name',
'description', 'description',

4
public/mix-manifest.json Normal file
View File

@ -0,0 +1,4 @@
{
"/js/app.js": "/js/app.js",
"/css/app.css": "/css/app.css"
}