Merge branch 'fix-shop-creation-seeder' into 'develop'
Fixed shop creation which failed with seeders See merge request ldc-web/projets/lionor!9
This commit is contained in:
commit
376aec992c
4 changed files with 2 additions and 44 deletions
|
|
@ -28,14 +28,6 @@ class Shop extends Model
|
|||
'longitude',
|
||||
];
|
||||
|
||||
/**
|
||||
* Initialize shop model.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->distance = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDistanceColumnShopsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('shops', function (Blueprint $table) {
|
||||
$table->integer('distance')
|
||||
->comment('Valeur à 0, sert pour l\'affichage et le calcul des distances')
|
||||
->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('shops', function (Blueprint $table) {
|
||||
$table->dropColumn('distance');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -318,7 +318,7 @@ export default defineComponent({
|
|||
shop.address + ", " + shop.postcode + " " + shop.city;
|
||||
// Display the distance
|
||||
let unit = " km";
|
||||
if (shop.distance < 1) {
|
||||
if (shop.distance === undefined) {
|
||||
unit = " mètres";
|
||||
shop.distance = shop.distance * 1000;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<span>{{ $shopModel->name }}</span>
|
||||
</td>
|
||||
<td>
|
||||
<span>{{ App\Enums\SignsEnum::toArray()[$shopModel->signs->value]->label }}</span>
|
||||
<span>{{ App\Enums\SignsEnum::toArray()[$shopModel->signs->value - 1]->label }}</span>
|
||||
</td>
|
||||
<td>{{ $shopModel->address }}, {{ $shopModel->postcode }} {{ $shopModel->city }}</td>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue