Skip to content

Commit

Permalink
Merge pull request #12 from roberts/drewroberts/feature/migrations
Browse files Browse the repository at this point in the history
Change Migrations
  • Loading branch information
drewroberts authored Mar 19, 2021
2 parents 9f853f5 + 2d1c65b commit 956cb76
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
17 changes: 12 additions & 5 deletions database/migrations/2021_01_01_100000_create_leads_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@ public function up()
$table->id();
$table->string('lead_number')->index()->unique(); // Generated by system. This is identifier used to communicate about the quote request & for additional form pages.
$table->string('email');
$table->foreignIdFor(LeadBusiness::class);
$table->foreignIdFor(app('user'))->nullable(); // Can be added later if the email from the lead matches a user in the system
$table->foreignIdFor(LeadBusiness::class); // moving to other table to reverse the relationship
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('position')->nullable();
$table->string('phone_number')->nullable(); // Will be replaced later with relationship to Phone model in tipoff/addresses

// Move these 3 fields to LeadBusiness table
$table->boolean('current_plan_under_cancellation')->nullable();
$table->date('current_plan_expires_at')->nullable();
$table->text('past_comp_claims')->nullable();
// Timestamps of when various processes completed. Will also have statuses added
$table->dateTime('form_completed_at')->nullable();
$table->dateTime('verified_at')->nullable();

// Move these 3 fields to LeadBusiness table
$table->boolean('current_plan_under_cancellation')->nullable();
$table->date('current_plan_expires_at')->nullable();
$table->text('past_comp_claims')->nullable();

$table->foreignIdFor(app('user'), 'creator_id')->nullable(); // Will seldom be used, but is needed in case a lead is added by a staff member on behalf of a lead that called in.
$table->foreignIdFor(app('user'), 'updater_id')->nullable(); // Most fields will be locked for updates in Nova, but we may allow some to be updated by staff.
$table->timestamps();
});
}
Expand Down
6 changes: 6 additions & 0 deletions src/Models/Lead.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@
use Carbon\Carbon;
use Illuminate\Support\Str;
use Tipoff\Support\Models\BaseModel;
use Tipoff\Support\Traits\HasCreator;
use Tipoff\Support\Traits\HasPackageFactory;
use Tipoff\Support\Traits\HasUpdater;

class Lead extends BaseModel
{
use HasCreator;
use HasPackageFactory;
use HasUpdater;

protected $guarded = [
'id',
'lead_number',
];

protected $casts = [
'form_completed_at' => 'datetime',
'verified_at' => 'datetime',
'current_plan_expires_at' => 'date',
'current_plan_under_cancellation' => 'boolean',
];
Expand Down

0 comments on commit 956cb76

Please sign in to comment.