generated from omnia-digital/catalyst-plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- move location migration to this plugin - update service provider to run migrations - update composer
- Loading branch information
1 parent
c2899cd
commit cb205de
Showing
6 changed files
with
82 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace OmniaDigital\CatalystLocation\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Carbon; | ||
use OmniaDigital\CatalystLocation\Models\Location; | ||
|
||
class LocationFactory extends Factory | ||
{ | ||
protected $model = Location::class; | ||
|
||
public function definition(): array | ||
{ | ||
return [ | ||
'address' => $this->faker->streetAddress(), | ||
'address_line_2' => null, | ||
'city' => $this->faker->city(), | ||
'state' => $this->faker->state(), | ||
'postal_code' => $this->faker->postcode(), | ||
'country' => $this->faker->countryCode(), | ||
'lat' => $this->faker->latitude(), | ||
'lng' => $this->faker->longitude(), | ||
'created_at' => Carbon::now(), | ||
'updated_at' => Carbon::now(), | ||
]; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
database/migrations/2022_05_07_160700_create_locations_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up() | ||
{ | ||
if (Schema::hasTable('locations')) { | ||
return; | ||
} | ||
Schema::create('locations', function (Blueprint $table) { | ||
$table->id(); | ||
$table->morphs('model'); | ||
$table->string('name')->nullable(); | ||
$table->string('address'); | ||
$table->string('address_line_2')->nullable(); | ||
$table->string('city'); | ||
$table->string('state'); | ||
$table->string('postal_code'); | ||
$table->string('country'); | ||
$table->string('lat')->nullable(); | ||
$table->string('lng')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
public function down() | ||
{ | ||
Schema::dropIfExists('team_locations'); | ||
} | ||
}; |
19 changes: 0 additions & 19 deletions
19
database/migrations/create_catalyst_location_plugin_table.php.stub
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters