diff --git a/app/Http/Controllers/Dashboard/ContentRecapController.php b/app/Http/Controllers/Dashboard/ContentRecapController.php index 11390dd..a188ab9 100644 --- a/app/Http/Controllers/Dashboard/ContentRecapController.php +++ b/app/Http/Controllers/Dashboard/ContentRecapController.php @@ -7,6 +7,7 @@ use App\Http\Requests\ContentRecapRequest; use App\Models\ContentRecap; use App\Models\ContentRecapClassification; +use Barryvdh\DomPDF\Facade\Pdf; use Carbon\Carbon; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -139,4 +140,14 @@ public function export(Request $request) return Excel::download(new ContentRecapExport($classification, $channel, $social_media, $posted_year, $posted_month, $posted_date), 'content-recaps-'.$formattedNow.'.xlsx'); } + + public function printData($id){ + + $contentRecap = ContentRecap::with(['enhancer', 'classification'])->findOrFail(decrypt_id($id)); + + + $pdf = Pdf::loadView('dashboard.content-recaps.print', compact('contentRecap')); + + return $pdf->stream(slugify('rekap konten '. $contentRecap->content_theme).'.pdf'); + } } diff --git a/app/Http/Controllers/Dashboard/DatatableController.php b/app/Http/Controllers/Dashboard/DatatableController.php index 8d91600..35c57fb 100644 --- a/app/Http/Controllers/Dashboard/DatatableController.php +++ b/app/Http/Controllers/Dashboard/DatatableController.php @@ -2156,6 +2156,8 @@ public function contentRecap(Request $request){ ->addColumn('action', function ($data) { $showUrl = route('dashboard.content.recaps.show', ['id' => encrypt_id($data->id)]); + $printUrl = route('dashboard.content.recaps.print', ['id' => encrypt_id($data->id)]); + $editUrl = route('dashboard.content.recaps.edit', ['id' => encrypt_id($data->id)]); $deleteUrl = route('dashboard.content.recaps.destroy', ['id' => encrypt_id($data->id)]); @@ -2166,6 +2168,10 @@ public function contentRecap(Request $request){
+