]> _ Git - psq.git/commitdiff
chroniques pharma v1
authorLouis Jeckel <louis.jeckel@outlook.com>
Thu, 29 Apr 2021 16:01:42 +0000 (18:01 +0200)
committerLouis Jeckel <louis.jeckel@outlook.com>
Thu, 29 Apr 2021 16:01:42 +0000 (18:01 +0200)
14 files changed:
app/Http/Controllers/Admin/PharmaChronicleController.php [new file with mode: 0644]
app/Http/Controllers/PharmaChronicleController.php [new file with mode: 0644]
app/Http/Requests/Admin/PharmaChronicleRequest.php [new file with mode: 0644]
app/Models/PharmaChronicle.php [new file with mode: 0644]
app/Models/Slugs/PharmaChronicleSlug.php [new file with mode: 0644]
app/Repositories/PharmaChronicleRepository.php [new file with mode: 0644]
config/twill-navigation.php
database/migrations/2021_04_29_141729_create_pharma_chronicles_tables.php [new file with mode: 0644]
resources/views/admin/pharmaChronicles/form.blade.php [new file with mode: 0644]
resources/views/admin/settings/strings.blade.php
resources/views/pharma-chronicle/index.blade.php [new file with mode: 0644]
resources/views/site/blocks/youtube.blade.php
routes/admin.php
routes/web.php

diff --git a/app/Http/Controllers/Admin/PharmaChronicleController.php b/app/Http/Controllers/Admin/PharmaChronicleController.php
new file mode 100644 (file)
index 0000000..4d400cf
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use A17\Twill\Http\Controllers\Admin\ModuleController;
+
+class PharmaChronicleController extends ModuleController
+{
+    protected $moduleName = 'pharmaChronicles';
+}
diff --git a/app/Http/Controllers/PharmaChronicleController.php b/app/Http/Controllers/PharmaChronicleController.php
new file mode 100644 (file)
index 0000000..bd09c6f
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\PharmaChronicle;
+use Illuminate\Http\Request;
+
+class PharmaChronicleController extends Controller
+{
+
+    public function index()
+    {
+        $videos = PharmaChronicle::query()
+            ->orderByDesc('broadcast_date')
+            ->published()
+            ->visible()
+            ->take(2)
+            ->get();
+        \View::share('title', "Les Chroniques Pharma");
+        \View::share('videos', $videos);
+
+        return view('pharma-chronicle.index');
+
+    }
+}
diff --git a/app/Http/Requests/Admin/PharmaChronicleRequest.php b/app/Http/Requests/Admin/PharmaChronicleRequest.php
new file mode 100644 (file)
index 0000000..f3b8d34
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\Http\Requests\Admin;
+
+use A17\Twill\Http\Requests\Admin\Request;
+
+class PharmaChronicleRequest extends Request
+{
+    public function rulesForCreate()
+    {
+        return [];
+    }
+
+    public function rulesForUpdate()
+    {
+        return [];
+    }
+}
diff --git a/app/Models/PharmaChronicle.php b/app/Models/PharmaChronicle.php
new file mode 100644 (file)
index 0000000..8307e95
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Models;
+
+use A17\Twill\Models\Behaviors\HasSlug;
+use A17\Twill\Models\Model;
+
+class PharmaChronicle extends Model
+{
+    use HasSlug;
+
+    protected $fillable = [
+        'published',
+        'title',
+        'youtube_link',
+        'broadcast_date',
+    ];
+
+    public $slugAttributes = [
+        'title',
+    ];
+
+}
diff --git a/app/Models/Slugs/PharmaChronicleSlug.php b/app/Models/Slugs/PharmaChronicleSlug.php
new file mode 100644 (file)
index 0000000..599ce89
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models\Slugs;
+
+use A17\Twill\Models\Model;
+
+class PharmaChronicleSlug extends Model
+{
+    protected $table = "pharma_chronicle_slugs";
+}
diff --git a/app/Repositories/PharmaChronicleRepository.php b/app/Repositories/PharmaChronicleRepository.php
new file mode 100644 (file)
index 0000000..4606fda
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Repositories;
+
+use A17\Twill\Repositories\Behaviors\HandleSlugs;
+use A17\Twill\Repositories\ModuleRepository;
+use App\Models\PharmaChronicle;
+
+class PharmaChronicleRepository extends ModuleRepository
+{
+    use HandleSlugs;
+
+    public function __construct(PharmaChronicle $model)
+    {
+        $this->model = $model;
+    }
+}
index bf6d8e40c8ada8ad53436f160696430a49786fc1..0348867dccbda6b804cfa9e5772a7d5cdf219dd8 100644 (file)
@@ -48,6 +48,10 @@ return [
                 'title' => 'Humeurs',
                 'module' => true
             ],
+            'pharmaChronicles' => [
+                'title' => 'Chroniques pharma',
+                'module' => true
+            ],
             'weeklyAgendas' => [
                 'title' => 'Agenda',
                 'module' => true
diff --git a/database/migrations/2021_04_29_141729_create_pharma_chronicles_tables.php b/database/migrations/2021_04_29_141729_create_pharma_chronicles_tables.php
new file mode 100644 (file)
index 0000000..9e3dd91
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+
+class CreatePharmaChroniclesTables extends Migration
+{
+    public function up()
+    {
+        Schema::create('pharma_chronicles', function (Blueprint $table) {
+            // this will create an id, a "published" column, and soft delete and timestamps columns
+            createDefaultTableFields($table);
+
+            // feel free to modify the name of this column, but title is supported by default (you would need to specify the name of the column Twill should consider as your "title" column in your module controller if you change it)
+            $table->string('title', 200)->nullable();
+
+            // your generated model and form include a description field, to get you started, but feel free to get rid of it if you don't need it
+            //$table->text('description')->nullable();
+
+            $table->text('youtube_link')->nullable();
+
+            $table->timestamp('broadcast_date')->nullable();
+
+            // add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date)
+            // $table->timestamp('publish_start_date')->nullable();
+        });
+
+        Schema::create('pharma_chronicle_slugs', function (Blueprint $table) {
+            createDefaultSlugsTableFields($table, 'pharma_chronicle');
+        });
+
+
+    }
+
+    public function down()
+    {
+
+        Schema::dropIfExists('pharma_chronicle_slugs');
+        Schema::dropIfExists('pharma_chronicles');
+    }
+}
diff --git a/resources/views/admin/pharmaChronicles/form.blade.php b/resources/views/admin/pharmaChronicles/form.blade.php
new file mode 100644 (file)
index 0000000..33a6a46
--- /dev/null
@@ -0,0 +1,18 @@
+@extends('twill::layouts.form')
+
+@section('contentFields')
+    @formField('input', [
+        'name' => 'youtube_link',
+        'label' => 'Lien YouTube',
+        'maxlength' => 500,
+        'required' => true
+
+    ])
+
+    @formField('date_picker', [
+        'name' => 'broadcast_date',
+        'label' => 'Date de diffusion',
+        'withTime' => false,
+        'required' => true
+    ])
+@stop
index fa8595a841b48b7cee2f5633b00daba7317e062e..528fef1195a6434f6fda0156122025580a144a0f 100644 (file)
@@ -1,6 +1,14 @@
 @extends('twill::layouts.settings', ['contentFieldsetLabel' => 'Modification du contenu statique'])
 
 @section('contentFields')
+
+    @formField('wysiwyg', [
+        'label' => 'Texte Chroniques Pharma',
+        'name' => 'pharma_chronicles_text',
+        'maxlength' => 1000,
+        'required' => true,
+        'toolbarOptions' => \App\Helpers\Fields::fullToolbar(),
+    ])
     @formField('wysiwyg', [
         'label' => 'Texte page pas encore abonné',
         'name' => 'not_registered_text',
diff --git a/resources/views/pharma-chronicle/index.blade.php b/resources/views/pharma-chronicle/index.blade.php
new file mode 100644 (file)
index 0000000..64cb477
--- /dev/null
@@ -0,0 +1,47 @@
+@extends('layouts.app')
+@inject('settings', \A17\Twill\Repositories\SettingRepository)
+
+@section('content')
+    <div class="container psq-podcasts">
+        <h1>L'actualité du médicament à la une de notre quotidien</h1>
+
+
+        <div class="mt-5 row">
+            <div class="col-md-7">
+                <img src="https://prescription-quotidien.com/images/e9ed1eeb-f2c9-48a2-b170-e46c8342fc58/Check-up-sante-web-204_3.jpg" alt="" class="w-100">
+
+                <div>
+                    <h2 class="text-center my-3">DÉCOUVREZ LA DERNIÈRE ÉMISSION DE CHECK-UP SANTÉ </h2>
+                    {!! $settings->byKey('pharma_chronicles_text') !!}
+                </div>
+
+            </div>
+
+            <div class="col-md-5">
+                <div class="text-center">
+                    <p>CHECK-UP SANTÉ</p>
+                    <p>RETROUVEZ LES DERNIÈRES</p>
+                    <p>CHRONIQUE PHARMA D'OLIVIER ROBICHON</p>
+
+
+                    @foreach($videos as $video)
+
+                        <h3>{{$video->broadcast_date}}</h3>
+                        <h3>{{$video->title}}</h3>
+                        @component('site.blocks.youtube', ['yt_url' => $video->youtube_link])
+                        @endcomponent
+
+
+                    @endforeach
+
+                </div>
+
+            </div>
+
+
+        </div>
+
+
+    </div>
+
+@endsection
index f19542817b271856fdf571ee86032c7518d12c66..f7194f97843fcdf627359f6169dc02ad942cb2d8 100644 (file)
@@ -1,5 +1,5 @@
 @php
-$url = \App\Helpers\StreamingPlatforms::youtubeEmbed($block->input('url'));
+$url = \App\Helpers\StreamingPlatforms::youtubeEmbed(isset($block) ? $block->input('url') : $yt_url);
 @endphp
 <div class="youtube-block">
     @if($url === null)
index b32397bee28c6059111d0a460672d7a766c9db70..fae1cbfee5216882f069b124baa20ce9722ad10c 100644 (file)
@@ -14,6 +14,7 @@ Route::prefix('content')->group(function() {
     Route::module('weeklyAgendas');
 //    Route::module('eventImages');
     Route::module('humeurs');
+    Route::module('pharmaChronicles');
     Route::module('guests'); //podcast guests
 
 });
index f7b4e32a7d815bfed3138e216164f2840698de74..65697227a7f30a8a34982d9bc8d0eb8ac3cf4c4e 100644 (file)
@@ -123,6 +123,9 @@ Route::domain(env('CLIENT_DOMAIN_NAME'))->group(function() {
     Route::get('humeurs/{slug}', 'HumeurController@show')->name('humeur.show');
     Route::get('agendas/{agenda:start_date}', 'AgendaController@show')->name('agenda.show');
 
+    Route::get('chroniques-pharma', 'PharmaChronicleController@index')->name('pharma-chronicle.index');
+
+
     Route::get('/l/{link:slug}', 'TrackedLinkController@redirect')->name('track');
 
     Route::get('site-ferme', 'WallController@wall');