2021-01-05 14:51:15 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
2021-04-02 17:18:43 +02:00
|
|
|
use App\Enums\OCBType;
|
2021-04-08 20:06:14 +02:00
|
|
|
use App\Models\OCBBreeder;
|
2021-01-05 14:51:15 +01:00
|
|
|
|
|
|
|
|
class OCBController extends Controller
|
|
|
|
|
{
|
2021-03-09 10:47:23 +01:00
|
|
|
public function testimonials()
|
|
|
|
|
{
|
2021-04-08 20:06:14 +02:00
|
|
|
$breeders = OCBBreeder::ocbValidated()->select('slug', 'picture', 'first_name', 'last_name')
|
2021-03-19 10:32:45 +01:00
|
|
|
->inRandomOrder()->limit(8)->get();
|
2021-01-29 12:17:47 +01:00
|
|
|
|
|
|
|
|
return view('front.ocb.testimonials', compact('breeders'));
|
2021-01-05 14:51:15 +01:00
|
|
|
}
|
|
|
|
|
|
2021-04-08 20:06:14 +02:00
|
|
|
public function breeder(OCBBreeder $breeder)
|
2021-03-09 10:00:35 +01:00
|
|
|
{
|
2021-01-08 14:00:22 +01:00
|
|
|
// Contient les images de l'exploitation de l'éleveur
|
|
|
|
|
$pictures = [];
|
2021-02-16 17:32:51 +01:00
|
|
|
if ($breeder->site !== null && $breeder->site->presentation_type === 2) {
|
2021-03-20 14:38:15 +01:00
|
|
|
if ($breeder->site->picture1 !== null) {
|
2021-01-08 14:00:22 +01:00
|
|
|
$pictures[] = $breeder->site->picture1;
|
2021-03-20 14:38:15 +01:00
|
|
|
}
|
|
|
|
|
if ($breeder->site->picture2 !== null) {
|
2021-01-08 14:00:22 +01:00
|
|
|
$pictures[] = $breeder->site->picture2;
|
2021-03-20 14:38:15 +01:00
|
|
|
}
|
|
|
|
|
if ($breeder->site->picture3 !== null) {
|
2021-01-08 14:00:22 +01:00
|
|
|
$pictures[] = $breeder->site->picture3;
|
2021-03-20 14:38:15 +01:00
|
|
|
}
|
2021-01-08 14:00:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return view('front.ocb.breeder', compact('breeder', 'pictures'));
|
2021-01-05 14:51:15 +01:00
|
|
|
}
|
2021-01-12 14:36:45 +01:00
|
|
|
|
2021-03-09 10:47:23 +01:00
|
|
|
public function poultry()
|
|
|
|
|
{
|
2021-04-08 20:06:14 +02:00
|
|
|
$breeder = OCBBreeder::inRandomOrder()->first();
|
2021-04-02 17:18:43 +02:00
|
|
|
$ocbType = OCBType::poultry();
|
|
|
|
|
return view('front.ocb.poultry', compact('breeder', 'ocbType'));
|
2021-01-12 14:36:45 +01:00
|
|
|
}
|
2021-01-05 14:51:15 +01:00
|
|
|
}
|