complete story 15.1
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\PotentialClientType;
|
||||
use App\Models\PotentialClient;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class PotentialClientFactory extends Factory
|
||||
{
|
||||
protected $model = PotentialClient::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'type' => fake()->randomElement(PotentialClientType::cases()),
|
||||
'name' => fake()->name(),
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'email' => fake()->safeEmail(),
|
||||
'address' => fake()->address(),
|
||||
'social_media' => fake()->url(),
|
||||
'website' => fake()->url(),
|
||||
'notes' => fake()->optional()->sentence(),
|
||||
];
|
||||
}
|
||||
|
||||
public function individual(): static
|
||||
{
|
||||
return $this->state(['type' => PotentialClientType::Individual]);
|
||||
}
|
||||
|
||||
public function company(): static
|
||||
{
|
||||
return $this->state(['type' => PotentialClientType::Company]);
|
||||
}
|
||||
|
||||
public function agency(): static
|
||||
{
|
||||
return $this->state(['type' => PotentialClientType::Agency]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('potential_clients', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('type');
|
||||
$table->string('name')->nullable();
|
||||
$table->string('phone', 50)->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->text('address')->nullable();
|
||||
$table->string('social_media')->nullable();
|
||||
$table->string('website')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('potential_clients');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user