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');
+ }
}
protected $appends = [
'coverUrl',
+ 'viewCount'
];
protected $fillable = [
-
-
-
-
/**
* @return int
*/
- public function getAccessCountAttribute(): int
+ public function getViewCountAttribute()
{
return $this->accessLogs()->count();
}
'title' => "Page d'accueil",
'route' => 'admin.content.homepage',
],
-// 'pdfFiles' => [
-// 'title' => 'Lettres',
-// 'module' => true
-// ],
+ 'pdfFiles' => [
+ 'title' => 'Lettres',
+ 'module' => true
+ ],
'adCampaigns' => [
'title' => 'Campagnes publicitaires',
--- /dev/null
+@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