diff --git a/app/Datatables/Shop/SaleChannelsDataTable.php b/app/Datatables/Shop/SaleChannelsDataTable.php index 7282aea5..419a4b0f 100644 --- a/app/Datatables/Shop/SaleChannelsDataTable.php +++ b/app/Datatables/Shop/SaleChannelsDataTable.php @@ -12,7 +12,7 @@ class SaleChannelsDataTable extends DataTable public function query(SaleChannel $model) { - $model = $model->withCount('deliveries'); + $model = $model->withCount(['deliveries', 'tariffs']); return $this->buildQuery($model); } @@ -21,7 +21,8 @@ class SaleChannelsDataTable extends DataTable return [ Column::make('code')->title('Code abrégé')->width(100), Column::make('name')->title('Nom'), - Column::make('deliveries_count')->title(__('shop.deliveries.list'))->searchable(false)->class('text-right'), + Column::make('deliveries_count')->title('#Distrib')->searchable(false)->class('text-right'), + Column::make('tariffs_count')->title('#Tarifs')->searchable(false)->class('text-right'), $this->makeColumnButtons(), ]; } diff --git a/app/Http/Controllers/Admin/Shop/SaleChannelController.php b/app/Http/Controllers/Admin/Shop/SaleChannelController.php index 0df07be8..ad4078a8 100644 --- a/app/Http/Controllers/Admin/Shop/SaleChannelController.php +++ b/app/Http/Controllers/Admin/Shop/SaleChannelController.php @@ -5,7 +5,6 @@ namespace App\Http\Controllers\Admin\Shop; use Illuminate\Http\Request; use App\Http\Controllers\Controller; -use App\Repositories\Shop\ArticleNatures; use App\Repositories\Shop\SaleChannels; use App\Datatables\Shop\SaleChannelsDataTable; diff --git a/app/Models/Shop/SaleChannel.php b/app/Models/Shop/SaleChannel.php index 50139fe3..7bc42f85 100644 --- a/app/Models/Shop/SaleChannel.php +++ b/app/Models/Shop/SaleChannel.php @@ -21,6 +21,6 @@ class SaleChannel extends Model public function tariffs() { - return $this->hasManyThrough(Tariff::class, PriceList::class, 'id1', 'tariff_id', 'id2', 'id3') + return $this->hasManyThrough(Tariff::class, PriceList::class, 'sale_channel_id', 'id', 'id', 'tariff_id'); } } diff --git a/app/Repositories/Shop/PriceListValues.php b/app/Repositories/Shop/PriceListValues.php index b7457869..fa97e36c 100644 --- a/app/Repositories/Shop/PriceListValues.php +++ b/app/Repositories/Shop/PriceListValues.php @@ -5,21 +5,33 @@ namespace App\Repositories\Shop; use Illuminate\Support\Facades\DB; use Illuminate\Support\Str; -use Yajra\DataTables\DataTables; - use App\Models\Shop\PriceListValue; +use App\Models\Shop\PriceList; +use App\Models\Shop\Offer; class PriceListValues { - public static function getByPriceListValue($id) + + public static function getPriceByOffer($offer_id, $quantity = 1, $sale_channel_id = false) { - return PriceListValue::byPriceListValue($id)->get(); + $prices = self::getPricesByOffer($offer_id, $sale_channel_id); + $price = $prices ? $prices->where('quantity', '<=', $quantity)->sortByDesc('quantity')->first() : false; + return $price ? $price->price_taxed : false; } - public static function getDatatable() + public static function getPricesByOffer($offer_id, $sale_channel_id = false) { - $model = PriceListValue::orderBy('name'); - return Datatables::of($model)->make(true); + $price_list = Offer::with([ + 'price_lists' => function ($query) use ($sale_channel_id) { + $sale_channel_id ? $query->bySaleChannel($sale_channel_id) : $query; + }, + ])->find($offer_id)->price_lists->first(); + return $price_list ? $price_list->price_list_values : false; + } + + public static function getByPriceList($id) + { + return PriceListValue::byPriceList($id)->get(); } public static function getAll() diff --git a/app/Repositories/Shop/PriceLists.php b/app/Repositories/Shop/PriceLists.php index 99d1f3c3..e8a19d36 100644 --- a/app/Repositories/Shop/PriceLists.php +++ b/app/Repositories/Shop/PriceLists.php @@ -11,6 +11,11 @@ use App\Models\Shop\PriceList; class PriceLists { + public static function getByOfferAndSaleChannel($offer_id, $sale_channel_id) + { + return PriceList::bySaleChannel($sale_channel_id)->byOffer($offer_id)->get(); + } + public static function getByOffer($offer_id) { return PriceList::byOffer($offer_id)->get(); diff --git a/app/Repositories/Shop/TagGroups.php b/app/Repositories/Shop/TagGroups.php index 3b9231db..8f421535 100644 --- a/app/Repositories/Shop/TagGroups.php +++ b/app/Repositories/Shop/TagGroups.php @@ -16,7 +16,7 @@ class TagGroups public static function getWithTagsAndCountOffers() { $tags = Tag::withCount(['articles'])->get()->toArray(); - $tag_groups = TagGroup::pluck('name','id')->toArray(); + $tag_groups = TagGroup::pluck('name', 'id')->toArray(); foreach ($tags as $tag) { $data[$tag['tag_group_id']]['name'] = $tag_groups[$tag['tag_group_id']]; $data[$tag['tag_group_id']]['tags'][] = [ diff --git a/database/migrations/backups/2020_04_20_212813_create_activity_log_table.php b/database/migrations/backups/2020_04_20_212813_create_activity_log_table.php deleted file mode 100644 index 1c5d4777..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_activity_log_table.php +++ /dev/null @@ -1,42 +0,0 @@ -bigInteger('id', true)->unsigned(); - $table->string('log_name')->nullable()->index(); - $table->text('description', 65535); - $table->bigInteger('subject_id')->unsigned()->nullable(); - $table->string('subject_type')->nullable(); - $table->bigInteger('causer_id')->unsigned()->nullable(); - $table->string('causer_type')->nullable(); - $table->text('properties', 65535)->nullable(); - $table->timestamps(); - $table->index(['subject_id','subject_type'], 'subject'); - $table->index(['causer_id','causer_type'], 'causer'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('activity_log'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_authentication_log_table.php b/database/migrations/backups/2020_04_20_212813_create_authentication_log_table.php deleted file mode 100644 index 8b85f702..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_authentication_log_table.php +++ /dev/null @@ -1,39 +0,0 @@ -bigInteger('id', true)->unsigned(); - $table->string('authenticatable_type'); - $table->bigInteger('authenticatable_id')->unsigned(); - $table->string('ip_address', 45)->nullable(); - $table->text('user_agent', 65535)->nullable(); - $table->dateTime('login_at')->nullable(); - $table->dateTime('logout_at')->nullable(); - $table->index(['authenticatable_type','authenticatable_id']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('authentication_log'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_categories_table.php b/database/migrations/backups/2020_04_20_212813_create_categories_table.php deleted file mode 100644 index db9a36b3..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_categories_table.php +++ /dev/null @@ -1,41 +0,0 @@ -increments('id'); - $table->string('slug')->unique(); - $table->text('name', 65535); - $table->text('description', 65535)->nullable(); - $table->integer('_lft')->unsigned()->default(0); - $table->integer('_rgt')->unsigned()->default(0); - $table->integer('parent_id')->unsigned()->nullable(); - $table->timestamps(); - $table->softDeletes(); - $table->index(['_lft','_rgt','parent_id']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('categories'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_categorizables_table.php b/database/migrations/backups/2020_04_20_212813_create_categorizables_table.php deleted file mode 100644 index 1f447817..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_categorizables_table.php +++ /dev/null @@ -1,37 +0,0 @@ -integer('category_id')->unsigned(); - $table->string('categorizable_type'); - $table->bigInteger('categorizable_id')->unsigned(); - $table->timestamps(); - $table->unique(['category_id','categorizable_id','categorizable_type'], 'categorizables_ids_type_unique'); - $table->index(['categorizable_type','categorizable_id']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('categorizables'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_failed_jobs_table.php b/database/migrations/backups/2020_04_20_212813_create_failed_jobs_table.php deleted file mode 100644 index 547aa370..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_failed_jobs_table.php +++ /dev/null @@ -1,37 +0,0 @@ -bigInteger('id', true)->unsigned(); - $table->text('connection', 65535); - $table->text('queue', 65535); - $table->text('payload'); - $table->text('exception'); - $table->timestamp('failed_at')->default(DB::raw('CURRENT_TIMESTAMP')); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('failed_jobs'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_mail_logs_table.php b/database/migrations/backups/2020_04_20_212813_create_mail_logs_table.php deleted file mode 100644 index 1be1a777..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_mail_logs_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->string('sent_to')->nullable(); - $table->text('data', 65535); - $table->text('route', 65535); - $table->text('event', 65535); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('mail_logs'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_media_table.php b/database/migrations/backups/2020_04_20_212813_create_media_table.php deleted file mode 100644 index bb51d83d..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_media_table.php +++ /dev/null @@ -1,46 +0,0 @@ -bigInteger('id', true)->unsigned(); - $table->string('model_type'); - $table->bigInteger('model_id')->unsigned(); - $table->string('collection_name'); - $table->string('name'); - $table->string('file_name'); - $table->string('mime_type')->nullable(); - $table->string('disk'); - $table->bigInteger('size')->unsigned(); - $table->text('manipulations'); - $table->text('custom_properties'); - $table->text('responsive_images'); - $table->integer('order_column')->unsigned()->nullable(); - $table->timestamps(); - $table->index(['model_type','model_id']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('media'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_password_resets_table.php b/database/migrations/backups/2020_04_20_212813_create_password_resets_table.php deleted file mode 100644 index 2fcab1ae..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_password_resets_table.php +++ /dev/null @@ -1,34 +0,0 @@ -string('email')->index(); - $table->string('token'); - $table->dateTime('created_at')->nullable(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('password_resets'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_permission_role_table.php b/database/migrations/backups/2020_04_20_212813_create_permission_role_table.php deleted file mode 100644 index eecec240..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_permission_role_table.php +++ /dev/null @@ -1,34 +0,0 @@ -integer('permission_id')->unsigned(); - $table->integer('role_id')->unsigned()->index('permission_role_role_id_foreign'); - $table->primary(['permission_id','role_id']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('permission_role'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_permission_user_table.php b/database/migrations/backups/2020_04_20_212813_create_permission_user_table.php deleted file mode 100644 index 6b34fa11..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_permission_user_table.php +++ /dev/null @@ -1,35 +0,0 @@ -integer('permission_id')->unsigned(); - $table->integer('user_id')->unsigned(); - $table->string('user_type'); - $table->primary(['permission_id','user_id','user_type']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('permission_user'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_permissions_categories_table.php b/database/migrations/backups/2020_04_20_212813_create_permissions_categories_table.php deleted file mode 100644 index f714a73e..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_permissions_categories_table.php +++ /dev/null @@ -1,34 +0,0 @@ -increments('id'); - $table->string('name')->unique(); - $table->string('display_name'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('permissions_categories'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_permissions_table.php b/database/migrations/backups/2020_04_20_212813_create_permissions_table.php deleted file mode 100644 index 1c0628bf..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_permissions_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->integer('category_id')->unsigned()->nullable()->index('permissions_category_id_foreign'); - $table->string('name')->unique(); - $table->string('display_name')->nullable(); - $table->string('description')->nullable(); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('permissions'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_role_user_table.php b/database/migrations/backups/2020_04_20_212813_create_role_user_table.php deleted file mode 100644 index 6b64a4b3..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_role_user_table.php +++ /dev/null @@ -1,35 +0,0 @@ -bigInteger('user_id')->unsigned(); - $table->integer('role_id')->unsigned()->index('role_user_role_id_foreign'); - $table->string('user_type'); - $table->primary(['user_id','role_id','user_type']); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('role_user'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_roles_table.php b/database/migrations/backups/2020_04_20_212813_create_roles_table.php deleted file mode 100644 index 0aa40741..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_roles_table.php +++ /dev/null @@ -1,36 +0,0 @@ -increments('id'); - $table->string('name')->unique(); - $table->string('display_name')->nullable(); - $table->string('description')->nullable(); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('roles'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_tagging_tag_groups_table.php b/database/migrations/backups/2020_04_20_212813_create_tagging_tag_groups_table.php deleted file mode 100644 index 12390172..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_tagging_tag_groups_table.php +++ /dev/null @@ -1,34 +0,0 @@ -increments('id'); - $table->string('slug', 125)->index(); - $table->string('name', 125); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('tagging_tag_groups'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_tagging_tagged_table.php b/database/migrations/backups/2020_04_20_212813_create_tagging_tagged_table.php deleted file mode 100644 index 11681ff1..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_tagging_tagged_table.php +++ /dev/null @@ -1,36 +0,0 @@ -increments('id'); - $table->integer('taggable_id')->unsigned()->index(); - $table->string('taggable_type', 125)->index(); - $table->string('tag_name', 125); - $table->string('tag_slug', 125)->index(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('tagging_tagged'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_tagging_tags_table.php b/database/migrations/backups/2020_04_20_212813_create_tagging_tags_table.php deleted file mode 100644 index a26141f9..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_tagging_tags_table.php +++ /dev/null @@ -1,37 +0,0 @@ -increments('id'); - $table->string('slug', 125)->index(); - $table->string('name', 125); - $table->boolean('suggest')->default(0); - $table->integer('count')->unsigned()->default(0); - $table->integer('tag_group_id')->unsigned()->nullable()->index('tagging_tags_tag_group_id_foreign'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('tagging_tags'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_team_invites_table.php b/database/migrations/backups/2020_04_20_212813_create_team_invites_table.php deleted file mode 100644 index 2cf3c8a9..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_team_invites_table.php +++ /dev/null @@ -1,39 +0,0 @@ -increments('id'); - $table->bigInteger('user_id')->unsigned(); - $table->integer('team_id')->unsigned()->index('team_invites_team_id_foreign'); - $table->enum('type', array('invite','request')); - $table->string('email'); - $table->string('accept_token'); - $table->string('deny_token'); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('team_invites'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_team_user_table.php b/database/migrations/backups/2020_04_20_212813_create_team_user_table.php deleted file mode 100644 index 921a85d2..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_team_user_table.php +++ /dev/null @@ -1,34 +0,0 @@ -bigInteger('user_id')->unsigned()->index('team_user_user_id_foreign'); - $table->integer('team_id')->unsigned()->index('team_user_team_id_foreign'); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('team_user'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_teams_table.php b/database/migrations/backups/2020_04_20_212813_create_teams_table.php deleted file mode 100644 index 7e09e69a..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_teams_table.php +++ /dev/null @@ -1,35 +0,0 @@ -increments('id'); - $table->integer('owner_id')->unsigned()->nullable(); - $table->string('name'); - $table->timestamps(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('teams'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212813_create_users_table.php b/database/migrations/backups/2020_04_20_212813_create_users_table.php deleted file mode 100644 index 16208513..00000000 --- a/database/migrations/backups/2020_04_20_212813_create_users_table.php +++ /dev/null @@ -1,45 +0,0 @@ -bigInteger('id', true)->unsigned(); - $table->boolean('active')->default(0); - $table->string('first_name')->nullable(); - $table->string('last_name')->nullable(); - $table->string('email')->unique(); - $table->dateTime('email_verified_at')->nullable(); - $table->string('password'); - $table->string('remember_token', 100)->nullable(); - $table->timestamps(); - $table->softDeletes(); - $table->dateTime('last_login')->nullable(); - $table->boolean('verified')->default(0); - $table->string('verification_token')->nullable(); - $table->integer('current_team_id')->unsigned()->nullable(); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::drop('users'); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_categorizables_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_categorizables_table.php deleted file mode 100644 index 887bf833..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_categorizables_table.php +++ /dev/null @@ -1,35 +0,0 @@ -foreign('category_id')->references('id')->on('categories')->onUpdate('CASCADE')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('categorizables', function(Blueprint $table) - { - $table->dropForeign('categorizables_category_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_role_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_role_table.php deleted file mode 100644 index be06b508..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_role_table.php +++ /dev/null @@ -1,37 +0,0 @@ -foreign('permission_id')->references('id')->on('permissions')->onUpdate('CASCADE')->onDelete('CASCADE'); - $table->foreign('role_id')->references('id')->on('roles')->onUpdate('CASCADE')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('permission_role', function(Blueprint $table) - { - $table->dropForeign('permission_role_permission_id_foreign'); - $table->dropForeign('permission_role_role_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_user_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_user_table.php deleted file mode 100644 index 7f76d0c9..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permission_user_table.php +++ /dev/null @@ -1,35 +0,0 @@ -foreign('permission_id')->references('id')->on('permissions')->onUpdate('CASCADE')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('permission_user', function(Blueprint $table) - { - $table->dropForeign('permission_user_permission_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permissions_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permissions_table.php deleted file mode 100644 index ac305150..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_permissions_table.php +++ /dev/null @@ -1,35 +0,0 @@ -foreign('category_id')->references('id')->on('permissions_categories')->onUpdate('RESTRICT')->onDelete('SET NULL'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('permissions', function(Blueprint $table) - { - $table->dropForeign('permissions_category_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_role_user_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_role_user_table.php deleted file mode 100644 index c16eff1d..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_role_user_table.php +++ /dev/null @@ -1,37 +0,0 @@ -foreign('role_id')->references('id')->on('roles')->onUpdate('CASCADE')->onDelete('CASCADE'); - $table->foreign('user_id')->references('id')->on('users')->onUpdate('CASCADE')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('role_user', function(Blueprint $table) - { - $table->dropForeign('role_user_role_id_foreign'); - $table->dropForeign('role_user_user_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_tagging_tags_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_tagging_tags_table.php deleted file mode 100644 index 34d32ebe..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_tagging_tags_table.php +++ /dev/null @@ -1,35 +0,0 @@ -foreign('tag_group_id')->references('id')->on('tagging_tag_groups')->onUpdate('RESTRICT')->onDelete('RESTRICT'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('tagging_tags', function(Blueprint $table) - { - $table->dropForeign('tagging_tags_tag_group_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_invites_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_invites_table.php deleted file mode 100644 index 174af6ec..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_invites_table.php +++ /dev/null @@ -1,35 +0,0 @@ -foreign('team_id')->references('id')->on('teams')->onUpdate('RESTRICT')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('team_invites', function(Blueprint $table) - { - $table->dropForeign('team_invites_team_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_user_table.php b/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_user_table.php deleted file mode 100644 index 91a364ba..00000000 --- a/database/migrations/backups/2020_04_20_212817_add_foreign_keys_to_team_user_table.php +++ /dev/null @@ -1,37 +0,0 @@ -foreign('team_id')->references('id')->on('teams')->onUpdate('RESTRICT')->onDelete('CASCADE'); - $table->foreign('user_id')->references('id')->on('users')->onUpdate('CASCADE')->onDelete('CASCADE'); - }); - } - - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('team_user', function(Blueprint $table) - { - $table->dropForeign('team_user_team_id_foreign'); - $table->dropForeign('team_user_user_id_foreign'); - }); - } - -} diff --git a/database/migrations/backups/2021_06_05_192053_teamwork_setup_tables.php b/database/migrations/backups/2021_06_05_192053_teamwork_setup_tables.php deleted file mode 100644 index 144f40c9..00000000 --- a/database/migrations/backups/2021_06_05_192053_teamwork_setup_tables.php +++ /dev/null @@ -1,83 +0,0 @@ -integer('current_team_id')->unsigned()->nullable(); - }); - - Schema::create(\Config::get('teamwork.teams_table'), function (Blueprint $table) { - $table->increments('id')->unsigned(); - $table->integer('owner_id')->unsigned()->nullable(); - $table->string('name'); - $table->timestamps(); - }); - - Schema::create(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { - $table->bigInteger('user_id')->unsigned(); - $table->integer('team_id')->unsigned(); - $table->timestamps(); - - $table->foreign('user_id') - ->references(\Config::get('teamwork.user_foreign_key')) - ->on(\Config::get('teamwork.users_table')) - ->onUpdate('cascade') - ->onDelete('cascade'); - - $table->foreign('team_id') - ->references('id') - ->on(\Config::get('teamwork.teams_table')) - ->onDelete('cascade'); - }); - - Schema::create(\Config::get('teamwork.team_invites_table'), function (Blueprint $table) { - $table->increments('id'); - $table->bigInteger('user_id')->unsigned(); - $table->integer('team_id')->unsigned(); - $table->enum('type', ['invite', 'request']); - $table->string('email'); - $table->string('accept_token'); - $table->string('deny_token'); - $table->timestamps(); - $table->foreign('team_id') - ->references('id') - ->on(\Config::get('teamwork.teams_table')) - ->onDelete('cascade'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table(\Config::get('teamwork.users_table'), function (Blueprint $table) { - $table->dropColumn('current_team_id'); - }); - - Schema::table(\Config::get('teamwork.team_user_table'), function (Blueprint $table) { - if (DB::getDriverName() !== 'sqlite') { - $table->dropForeign(\Config::get('teamwork.team_user_table').'_user_id_foreign'); - } - if (DB::getDriverName() !== 'sqlite') { - $table->dropForeign(\Config::get('teamwork.team_user_table').'_team_id_foreign'); - } - }); - - Schema::drop(\Config::get('teamwork.team_user_table')); - Schema::drop(\Config::get('teamwork.team_invites_table')); - Schema::drop(\Config::get('teamwork.teams_table')); - } -}