diff --git a/app/Http/Controllers/Bo/MagasinsController.php b/app/Http/Controllers/Bo/MagasinsController.php new file mode 100644 index 0000000..85c8b28 --- /dev/null +++ b/app/Http/Controllers/Bo/MagasinsController.php @@ -0,0 +1,11 @@ +firstOrFail(); - return view('sales.confirm', compact('activestep', 'order')); + //1 seul magasin en base pour le moment + $magasin = Magasin::first(); + + return view('sales.confirm', compact('activestep', 'order', 'magasin')); } /** diff --git a/app/Http/Controllers/ContactController.php b/app/Http/Controllers/ContactController.php index 65d6fc7..a17f06c 100644 --- a/app/Http/Controllers/ContactController.php +++ b/app/Http/Controllers/ContactController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use App\Http\Requests\ContactFormRequest; use App\Mail\SendContactMail; +use App\Models\Magasin; use App\Models\Setting; use Illuminate\Support\Facades\Mail; use Illuminate\Http\Request; @@ -14,7 +15,10 @@ class ContactController extends Controller { $status = $request->session()->get('status'); - return view('contact', compact('status')); + //1 seul magasin en base pour le moment + $magasin = Magasin::first(); + + return view('contact', compact('status', 'magasin')); } public function contactSubmit(ContactFormRequest $request) diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 1059035..1a2a539 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -7,6 +7,7 @@ use App\Http\Requests\UpdateInfosRequest; use App\Mail\PasswordResetMail; use App\Mail\RegisterConfirmMail; use App\Models\Customers; +use App\Models\Magasin; use App\Models\Order; use App\Models\PasswordReset; use Exception; @@ -368,7 +369,9 @@ class CustomerController extends Controller $order = Order::where('reference', '=', $reference) ->where('customer_id', Auth::guard('customer')->user()->id) ->firstOrFail(); - return view('customer.order-detail', compact('order')); + $magasin = Magasin::first(); + + return view('customer.order-detail', compact('order', 'magasin')); } public function delete($id) diff --git a/app/Http/Controllers/IndexController.php b/app/Http/Controllers/IndexController.php index 30e3840..f21bb9b 100644 --- a/app/Http/Controllers/IndexController.php +++ b/app/Http/Controllers/IndexController.php @@ -9,6 +9,9 @@ use Illuminate\Http\Request; class IndexController extends Controller { + /** + * deprecated + */ public function contact(Request $request) { $content = Content::where('key', 'contact')->first(); diff --git a/app/Mail/OrderConfirmMail.php b/app/Mail/OrderConfirmMail.php index 5aef5c8..9aa451b 100644 --- a/app/Mail/OrderConfirmMail.php +++ b/app/Mail/OrderConfirmMail.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\Magasin; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; @@ -30,7 +31,9 @@ class OrderConfirmMail extends Mailable */ public function build() { - $order = $this->order; - return $this->subject("Votre commande - " . config('theme.site_name'))->view('mails.order-confirm', compact('order')); + $order = $this->order; + $magasin = Magasin::first(); + + return $this->subject("Votre commande - " . config('theme.site_name'))->view('mails.order-confirm', compact('order', 'magasin')); } } diff --git a/app/Mail/OrderStatusMail.php b/app/Mail/OrderStatusMail.php index 822cc40..4759c69 100644 --- a/app/Mail/OrderStatusMail.php +++ b/app/Mail/OrderStatusMail.php @@ -2,6 +2,7 @@ namespace App\Mail; +use App\Models\Magasin; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Mail\Mailable; @@ -31,6 +32,8 @@ class OrderStatusMail extends Mailable public function build() { $order = $this->order; - return $this->subject("Votre commande - " . config('theme.site_name'))->view('mails.order-status', compact('order')); + $magasin = Magasin::first(); + + return $this->subject("Votre commande - " . config('theme.site_name'))->view('mails.order-status', compact('order', 'magasin')); } } diff --git a/app/Models/Magasin.php b/app/Models/Magasin.php new file mode 100644 index 0000000..f62ab69 --- /dev/null +++ b/app/Models/Magasin.php @@ -0,0 +1,11 @@ +id(); + $table->string('name'); + $table->string('address'); + $table->string('postcode'); + $table->string('city'); + $table->string('phone')->nullable(); + $table->string('latitude')->nullable(); + $table->string('longitude')->nullable(); + $table->text('gmaps_placeid')->nullable(); + $table->text('gmaps_link_href')->nullable(); + $table->text('gmaps_embed_href')->nullable(); + $table->timestamps(); + }); + + $seeder = new MagasinsSeeder; + $seeder->run(); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('magasins'); + } +} diff --git a/database/seeders/MagasinsSeeder.php b/database/seeders/MagasinsSeeder.php new file mode 100644 index 0000000..606c80d --- /dev/null +++ b/database/seeders/MagasinsSeeder.php @@ -0,0 +1,26 @@ +name = 'Boutique du Canard'; + $shop->address = 'ZI Le Moulin du Lay'; + $shop->postcode = '56660'; + $shop->city = 'Saint-Jean-Brévelay'; + $shop->gmaps_embed_href = 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d1338.6273890542313!2d-2.72895304171439!3d47.85402879462169!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x481027805e253b01%3A0x9238845cc1430920!2sCELVIA%20Centre%20d'Elaboration%20des%20Viandes!5e0!3m2!1sfr!2sfr!4v1619018555708!5m2!1sfr!2sfr'; + $shop->gmaps_link_href = 'https://goo.gl/maps/CPWELAXDLHAbUsgeA' + $shop->save(); + } +}