Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Booking Model Review #47

Merged
merged 45 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b06858c
Migrations
chx2 Mar 6, 2021
8beac08
Remove remaining slot details
chx2 Mar 6, 2021
39d9d1e
Fix styling
chx2 Mar 6, 2021
ab26cce
Remove SlotFactory
chx2 Mar 6, 2021
aed90bf
Merge remote-tracking branch 'origin/chx2/feature/booking-model-revie…
chx2 Mar 6, 2021
c6ca022
Rates #42
chx2 Mar 6, 2021
c3c80b9
remove slot config array and service_class use in slot classes
wolfrednicolas Mar 8, 2021
b9e89fe
remove SlotFactory
wolfrednicolas Mar 8, 2021
1814073
remove Slot Migration
wolfrednicolas Mar 8, 2021
72e79c7
remove Slot from the BookingServiceProvider
wolfrednicolas Mar 8, 2021
5bbb658
remove Slot model
wolfrednicolas Mar 8, 2021
a55e59b
change the namespaces in the filterClassList array in the booking model
wolfrednicolas Mar 8, 2021
62987fd
remove FutureSlots from nova filters
wolfrednicolas Mar 8, 2021
3d229a6
remove SlotDayFilter
wolfrednicolas Mar 8, 2021
b4446bd
remove Nova Slot model
wolfrednicolas Mar 8, 2021
f420d01
remove SlotPolicy
wolfrednicolas Mar 8, 2021
1ba0d7b
remove slot from the novaPackageServiceProvider
wolfrednicolas Mar 8, 2021
150f852
Rate Category #42
chx2 Mar 9, 2021
8b0fa93
Update booking category references #40
chx2 Mar 9, 2021
46d9aac
Merge branch 'wolfrednicolas/feature/remove-slot-model-and-dependenci…
wolfrednicolas Mar 9, 2021
b0f7649
Merge branch 'chx2/feature/booking-model-review' of github.com:tipoff…
wolfrednicolas Mar 9, 2021
a004228
Use RateCategory in Rate factory #42
chx2 Mar 9, 2021
30df917
Merge remote-tracking branch 'origin/chx2/feature/booking-model-revie…
chx2 Mar 9, 2021
7e1186c
Rate Nova resource #42
chx2 Mar 9, 2021
3bf92ff
Fix styling
chx2 Mar 9, 2021
06f49e7
Add Nova resource to service provider #42
chx2 Mar 9, 2021
89a0e7a
Merge remote-tracking branch 'origin/chx2/feature/booking-model-revie…
chx2 Mar 9, 2021
83d1399
Policies
chx2 Mar 9, 2021
37a1c22
Fix styling
chx2 Mar 9, 2021
f023617
Updates to Rate #42
chx2 Mar 9, 2021
b303be3
Merge remote-tracking branch 'origin/chx2/feature/booking-model-revie…
chx2 Mar 9, 2021
52fd0f6
Add Rate to NovaServiceProvider #42
chx2 Mar 9, 2021
ea00552
Fix styling
chx2 Mar 9, 2021
eab0056
Add checkout, setup booking to use CartInterface #38
chx2 Mar 9, 2021
a7bca1a
Merge remote-tracking branch 'origin/chx2/feature/booking-model-revie…
chx2 Mar 9, 2021
01da2b5
Update Booking status migration #49
chx2 Mar 9, 2021
458f600
Update booking pricing methods
chx2 Mar 9, 2021
8eb005e
Call BookingRateInterface methods
chx2 Mar 9, 2021
271480a
Add references to Booking model
chx2 Mar 9, 2021
3382c7e
Rename migration & reorder date right after status
drewroberts Mar 10, 2021
a913ca6
Bump package dependencies
drewroberts Mar 10, 2021
b6d1294
Publish booking status method #41
drewroberts Mar 10, 2021
72c7d93
Rate Interface Methods #42
chx2 Mar 10, 2021
7d85fc8
Bump package dependencies
drewroberts Mar 11, 2021
a97788a
Require tipoff support with booking contracts
drewroberts Mar 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@
"php": "^7.4|^8.0",
"dniccum/phone-number": "^1.1",
"inspheric/nova-email-field": "^1.42",
"tipoff/authorization": "^2.3.0",
"tipoff/support": "^1.5.5"
"tipoff/authorization": "^2.5.0",
"tipoff/checkout": "^2.4.0",
"tipoff/statuses": "^2.0.2",
"tipoff/support": "^1.6.0"
},
"require-dev": {
"tipoff/test-support": "^1.1.2"
"tipoff/test-support": "^1.2.0"
},
"repositories": [
{
Expand Down
11 changes: 0 additions & 11 deletions config/bookings.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
<?php

return [

'collection_class' => [

'slot' => 'SlotsCollection'

],
'service_class' => [

'calendar' => App\Services\CalendarService::class

]
];
2 changes: 1 addition & 1 deletion database/factories/BookingCategoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BookingCategoryFactory extends Factory
public function definition()
{
return [
'name' => $this->faker->text
'label' => $this->faker->text
];
}
}
5 changes: 3 additions & 2 deletions database/factories/BookingFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\Bookings\Models\Booking;
use Tipoff\Bookings\Models\BookingCategory;
use Tipoff\Bookings\Models\BookingStatus;
use Tipoff\Bookings\Models\Rate;

class BookingFactory extends Factory
{
Expand All @@ -33,7 +33,8 @@ public function definition()
'total_taxes' => $this->faker->numberBetween(0, 10),
'total_fees' => $this->faker->numberBetween(0, 10),
'booking_category_id' => BookingCategory::factory()->create()->id,
// 'booking_status_id' => BookingStatus::factory()->create()->id
'rate_id' => Rate::factory()->create()->id,
//Todo: Add morph factories
];
}
}
32 changes: 32 additions & 0 deletions database/factories/RateCategoryFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace Tipoff\Bookings\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\Bookings\Models\RateCategory;

class RateCategoryFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = RateCategory::class;

/**
* Define the model's default state.
*
* @return array
* @throws \Exception
*/
public function definition()
{
return [
'slug' => $this->faker->url,
'name' => $this->faker->name
];
}
}
39 changes: 39 additions & 0 deletions database/factories/RateFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace Tipoff\Bookings\Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
use Tipoff\Bookings\Models\Rate;
use Tipoff\Bookings\Models\RateCategory;

class RateFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Rate::class;

/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$types = ['public', 'private'];
return [
'slug' => $this->faker->slug,
'name' => $this->faker->name,
'amount' => $this->faker->numberBetween(0, 9999),
'rate_type' => $types[array_rand($types)],
'participant_limit' => $this->faker->numberBetween(0, 100),
'rate_category_id' => RateCategory::factory()->create()->id,
'creator_id' => randomOrCreate(app('user')),
'updater_id' => randomOrCreate(app('user'))
];
}
}
65 changes: 0 additions & 65 deletions database/factories/SlotFactory.php

This file was deleted.

34 changes: 0 additions & 34 deletions database/migrations/2020_05_04_100000_create_slots_table.php

This file was deleted.

34 changes: 17 additions & 17 deletions database/migrations/2020_05_04_150000_create_bookings_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
use Illuminate\Support\Facades\Schema;
use Tipoff\Bookings\Models\BookingCategory;
use Tipoff\Bookings\Models\BookingStatus;
use Tipoff\Bookings\Models\Rate;

class CreateBookingsTable extends Migration
{
public function up()
{
Schema::create('bookings', function (Blueprint $table) {
$table->id();
$table->string('slot_number')->nullable();
$table->integer('total_participants')->nullable();
$table->string('slot_number');
$table->integer('total_participants');
$table->unsignedInteger('total_amount');
$table->unsignedInteger('amount')->nullable();
$table->unsignedInteger('total_taxes')->nullable();
$table->unsignedInteger('total_fees')->nullable();
// $table->morphs('variation')->nullable();
// $table->morphs('experience')->nullable();
// $table->morphs('order')->nullable();
$table->unsignedBigInteger('booking_category_id');
$table->foreign('booking_category_id')->references('id')->on('booking_categories');
// $table->unsignedBigInteger('booking_status_id');
// $table->foreign('booking_status_id')->references('id')->on('booking_status');
// $table->morphs('agent')->nullable();
// $table->morphs('user')->nullable();
// $table->morphs('subject')->nullable();
$table->datetime('proccessed_at')->nullable();;
$table->datetime('canceled_at')->nullable();;
$table->unsignedInteger('amount');
$table->unsignedInteger('total_taxes');
$table->unsignedInteger('total_fees');
$table->morphs(app('experience'));
$table->morphs(app('order'));
$table->foreignIdFor(Rate::class);
$table->foreignIdFor(BookingCategory::class);
$table->unsignedBigInteger('booking_status_id');
$table->foreign('booking_status_id')->references('id')->on('booking_status');
$table->morphs(app('agent'));
$table->morphs(app('user'));
$table->morphs(app('subject'));
$table->datetime('proccessed_at');
$table->datetime('canceled_at');
$table->timestamps();
});
}
Expand Down
18 changes: 18 additions & 0 deletions database/migrations/2020_05_08_115000_add_booking_statuses.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Tipoff\Statuses\Models\Status;

class AddBookingStatuses extends Migration
{
public function up()
{
Status::publishStatuses('booking', [
'Pending',
'Cancelled',
'Confirmed',
])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Tipoff\Bookings\Models\Booking;

class CreateParticipantsTable extends Migration
{
public function up()
{
Schema::create('participants', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(app('user'))->nullable()->index();
$table->morphs(app('user'));
$table->string('email')->unique();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->date('birth_date')->nullable();
$table->boolean('is_verified')->default(false);
$table->foreignIdFor(Booking::class);
$table->softDeletes(); // Soft delete if the participant email address bounces
$table->timestamps();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ public function up()
$permissions = [
'view bookings',
'create bookings',
'update bookings'
'update bookings',
'view booking categories',
'create booking categories',
'update booking categories',
'view participants',
'create participants',
'update participants',
'view rates',
'create rates',
'update rates',
'view rate categories',
'create rate categories',
'update rate categories',
];

$this->createPermissions($permissions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function up()
{
Schema::create('booking_categories', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('label');
$table->timestamps();
});
}
Expand Down
29 changes: 29 additions & 0 deletions database/migrations/2021_03_06_183050_create_rates_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Tipoff\Bookings\Models\Booking;
use Tipoff\Bookings\Models\RateCategory;

class CreateRatesTable extends Migration
{
public function up()
{
Schema::create('rates', function (Blueprint $table) {
$table->id();
$table->string('slug');
$table->string('name');
$table->unsignedInteger('amount');
$table->string('rate_type');
$table->foreignIdFor(Booking::class);
$table->foreignIdFor(RateCategory::class);
$table->unsignedInteger('participants_limit');
$table->foreignIdFor(app('user'), 'creator_id');
$table->foreignIdFor(app('user'), 'updater_id');
$table->timestamps();
});
}
}
Loading