]> _ Git - psq.git/commitdiff
viw pdf file
authorLouis Jeckel <louis.jeckel@outlook.cm>
Thu, 27 Aug 2020 21:41:31 +0000 (23:41 +0200)
committerLouis Jeckel <louis.jeckel@outlook.cm>
Thu, 27 Aug 2020 21:41:31 +0000 (23:41 +0200)
app/Http/Controllers/Admin/PdfFileController.php
app/PdfFile.php
config/twill-navigation.php
resources/views/admin/pdfFiles/show.blade.php [new file with mode: 0644]

index b278ed53c64d87876ceafcad918969b3b2f94d71..2678ba3aa54925cd377d4fc4a83a7b35c125ad3a 100644 (file)
@@ -3,14 +3,40 @@
 namespace App\Http\Controllers\Admin;
 
 use A17\Twill\Http\Controllers\Admin\ModuleController;
+use App\PdfFile;
 
 class PdfFileController extends ModuleController
 {
     protected $moduleName = 'pdfFiles';
 
 
-
-
+    protected $indexOptions = [
+        'create' => false,
+        'publish' => false,
+        'delete' => false,
+        'restore' => false,
+    ];
+
+    protected $indexColumns = [
+        'title' => [
+            'title' => 'Titre',
+            'field' => 'title'
+        ],
+        'viewCount' => [
+            'title' => 'Vues',
+            'field' => 'viewCount'
+        ]
+    ];
+
+    public function edit($id, $submoduleId = null)
+    {
+        $pdf = PdfFile::with(['trackedLinks'])
+            ->withCount('accessLogs')
+            ->find($id);
+
+        \View::share('pdf', $pdf);
+        return view('admin.pdfFiles.show');
+    }
 
 
 }
index bf81529b33d9963d4c5bf01a2303670e3818fbc8..18fdea081fc981b4cb2c55ac164575322de3034d 100644 (file)
@@ -55,6 +55,7 @@ class PdfFile extends TwillModel implements Sortable
 
     protected $appends = [
         'coverUrl',
+        'viewCount'
     ];
 
     protected $fillable = [
@@ -203,14 +204,10 @@ class PdfFile extends TwillModel implements Sortable
 
 
 
-
-
-
-
     /**
      * @return int
      */
-    public function getAccessCountAttribute(): int
+    public function getViewCountAttribute()
     {
         return $this->accessLogs()->count();
     }
index 3197feb5b09f3cf27c9cf7216952917a1014edc1..a9060b2aea757fdf9f038a395f27ce131c08f234 100644 (file)
@@ -30,10 +30,10 @@ return [
                    'title' => "Page d'accueil",
                    'route' => 'admin.content.homepage',
                ],
-//                'pdfFiles' => [
-//                    'title' => 'Lettres',
-//                    'module' => true
-//                ],
+                'pdfFiles' => [
+                    'title' => 'Lettres',
+                    'module' => true
+                ],
 
                 'adCampaigns' => [
                     'title' => 'Campagnes publicitaires',
diff --git a/resources/views/admin/pdfFiles/show.blade.php b/resources/views/admin/pdfFiles/show.blade.php
new file mode 100644 (file)
index 0000000..d3599af
--- /dev/null
@@ -0,0 +1,45 @@
+@extends('admin.layouts.free')
+
+@section('content')
+
+    <div class="bootstrap">
+        <div class="container">
+            <div class="row">
+                <div class="col-3">
+                    <img src="{{$pdf->coverUrl}}" alt="" class="w-100">
+                </div>
+                <div class="col-9">
+                    <h1>{{$pdf->title}}</h1>
+                    <p>PubliĆ© le {{$pdf->created_at}}</p>
+                    <p>{{$pdf->access_logs_count}} vues</p>
+                    <div >
+                        <h2>Tags</h2>
+                        <input type="text">
+                        <h2>Headlines</h2>
+
+                    </div>
+                    <div >
+                        <h2>Links</h2>
+                        <table class="table table-hover">
+                            <thead>
+                            <tr>
+                                <th>Titre</th>
+                                <th>Clicks</th>
+                            </tr>
+                            </thead>
+                            <tbody>
+                            @foreach($pdf->trackedLinks as $link)
+                                <tr>
+                                    <td>{{$link->title}}</td>
+                                    <td>{{$link->clicks}}</td>
+                                </tr>
+                            @endforeach
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </div>
+@endsection