-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from tipoff/chx2/feature/refactored-models
GMB Details & Hours #44
- Loading branch information
Showing
21 changed files
with
303 additions
and
67 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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tipoff\Locations\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Facades\Date; | ||
use Tipoff\Locations\Models\GmbDetail; | ||
use Tipoff\Locations\Models\Location; | ||
|
||
class GmbDetailFactory extends Factory | ||
{ | ||
protected $model = GmbDetail::class; | ||
|
||
public function definition() | ||
{ | ||
return [ | ||
'name' => $this->faker->name, | ||
'opened_at' => $this->faker->date('Y-m-d'), | ||
'address' => $this->faker->address, | ||
'address2' => $this->faker->address, | ||
'city' => $this->faker->city, | ||
'state' => $this->faker->state, | ||
'zip' => $this->faker->postcode, | ||
'phone' => $this->faker->phoneNumber, | ||
'latitude' => $this->faker->latitude, | ||
'longitude' => $this->faker->longitude, | ||
'location_id' => Location::factory()->create()->id, | ||
'created_at' => Date::now() | ||
]; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tipoff\Locations\Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Facades\Date; | ||
use Tipoff\Locations\Models\GmbHour; | ||
use Tipoff\Locations\Models\Location; | ||
|
||
class GmbHourFactory extends Factory | ||
{ | ||
protected $model = GmbHour::class; | ||
|
||
public function definition() | ||
{ | ||
return [ | ||
'monday_open' => $this->faker->text, | ||
'monday_close' => $this->faker->text, | ||
'tuesday_open' => $this->faker->text, | ||
'tuesday_close' => $this->faker->text, | ||
'wednesday_open' => $this->faker->text, | ||
'wednesday_close' => $this->faker->text, | ||
'thursday_open' => $this->faker->text, | ||
'thursday_close' => $this->faker->text, | ||
'friday_open' => $this->faker->text, | ||
'friday_close' => $this->faker->text, | ||
'saturday_open' => $this->faker->text, | ||
'saturday_close' => $this->faker->text, | ||
'sunday_open' => $this->faker->text, | ||
'sunday_close' => $this->faker->text, | ||
'location_id' => Location::factory()->create()->id, | ||
'created_at' => Date::now() | ||
]; | ||
} | ||
} |
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
22 changes: 0 additions & 22 deletions
22
database/migrations/2014_01_01_100000_create_timezones_table.php
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
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
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,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tipoff\Locations\Models; | ||
|
||
use Tipoff\Support\Models\BaseModel; | ||
use Tipoff\Support\Traits\HasCreator; | ||
use Tipoff\Support\Traits\HasPackageFactory; | ||
use Tipoff\Support\Traits\HasUpdater; | ||
|
||
class GmbDetail extends BaseModel | ||
{ | ||
use HasPackageFactory; | ||
use HasCreator; | ||
use HasUpdater; | ||
|
||
public $timestamps = false; | ||
|
||
public function location() | ||
{ | ||
return $this->belongsTo(Location::class); | ||
} | ||
|
||
public function webpage() | ||
{ | ||
return $this->belongsTo(app('webpage')); | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tipoff\Locations\Models; | ||
|
||
use Tipoff\Support\Models\BaseModel; | ||
use Tipoff\Support\Traits\HasCreator; | ||
use Tipoff\Support\Traits\HasPackageFactory; | ||
use Tipoff\Support\Traits\HasUpdater; | ||
|
||
class GmbHour extends BaseModel | ||
{ | ||
use HasPackageFactory; | ||
use HasCreator; | ||
use HasUpdater; | ||
|
||
public $timestamps = false; | ||
|
||
public function location() | ||
{ | ||
return $this->belongsTo(Location::class); | ||
} | ||
} |
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
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tipoff\Locations\Policies; | ||
|
||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
use Tipoff\Locations\Models\GmbDetail; | ||
use Tipoff\Support\Contracts\Models\UserInterface; | ||
|
||
class GmbDetailPolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
public function viewAny(UserInterface $user): bool | ||
{ | ||
return $user->hasPermissionTo('view gmb details') ? true : false; | ||
} | ||
|
||
public function view(UserInterface $user, GmbDetail $gmb_detail): bool | ||
{ | ||
return $user->hasPermissionTo('view gmb details') ? true : false; | ||
} | ||
|
||
public function create(UserInterface $user): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function update(UserInterface $user, GmbDetail $gmb_detail): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function delete(UserInterface $user, GmbDetail $gmb_detail): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function restore(UserInterface $user, GmbDetail $gmb_detail): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function forceDelete(UserInterface $user, GmbDetail $gmb_detail): bool | ||
{ | ||
return false; | ||
} | ||
} |
Oops, something went wrong.