diff --git a/.gitignore b/.gitignore index f0d10af..e46f3cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ /node_modules /public/build /public/hot -/public/storage /storage/*.key /vendor .env diff --git a/app/Http/Controllers/MainController.php b/app/Http/Controllers/MainController.php index 0bd0dbd..cc9319f 100644 --- a/app/Http/Controllers/MainController.php +++ b/app/Http/Controllers/MainController.php @@ -601,10 +601,35 @@ class MainController extends Controller return view('house.post', compact('house', 'houses', 'count_user', 'title')); } + public function preview_PDF(House $house) { + if (!empty($house->foto_main)) { + $file_img = base64_encode(file_get_contents(public_path("storage/".$house->foto_main))); + } else { + $file_img = ""; + } + + $arr_house = ['0' => $house, 'image' => $file_img]; + view()->share('house',$arr_house); + $pdf = PDF::loadView('house.pdf', $arr_house); + return $pdf->stream(); + } + public function generate_PDF(House $house) { $arr_house = ['0' => $house]; view()->share('house',$arr_house); - $pdf = PDF::loadView('house.pdf', $arr_house); + $PDFOptions = ['enable_remote' => true, 'chroot' => public_path('storage/app/public')]; + //$PDFOptions = ['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true]; + $pdf = PDF::setOptions($PDFOptions)->loadView('house.pdf', $arr_house); + //$pdf = PDF::loadView('house.pdf', $arr_house); + /*$pdf->getDomPDF()->setHttpContext( + stream_context_create([ + 'ssl' => [ + 'allow_self_signed'=> TRUE, + 'verify_peer' => FALSE, + 'verify_peer_name' => FALSE, + ], + ]) + );*/ $id = $house->id; return $pdf->download("pdf_file_".$id.".pdf"); } diff --git a/public/storage/.gitignore b/public/storage/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/public/storage/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/resources/views/house/pdf.blade.php b/resources/views/house/pdf.blade.php index 5327e01..0ea36ce 100644 --- a/resources/views/house/pdf.blade.php +++ b/resources/views/house/pdf.blade.php @@ -20,8 +20,17 @@ +foto_main)) {?> + + + +foto_main)) {?> + + +
- Страница помещения + {{ route('offer', ['house' => $house[0]->id]) }}

{{ $house[0]->title }} {{ $house[0]->address }}

@@ -35,7 +44,7 @@
Аренда в год за м2: {{ $house[0]->rent_in_year }} ₽
Аренда в месяц: {{ $house[0]->price }} ₽
-
Схема сделки: {{ $house[0]->scheme_deal }}
Площадь, м2: {{ $house[0]->area }}
+
Схема сделки: {{ $house[0]->scheme_deal }}
Площадь, м2: {{ $house[0]->area }}
Адрес: {{ $house[0]->address }}
Тип объекта: {{ $house[0]->typearea->name_type }}
diff --git a/resources/views/house/post.blade.php b/resources/views/house/post.blade.php index 290492d..b20a450 100644 --- a/resources/views/house/post.blade.php +++ b/resources/views/house/post.blade.php @@ -171,7 +171,7 @@
- Скачать презентацию + Скачать презентацию diff --git a/resources/views/layout/site.blade.php b/resources/views/layout/site.blade.php index 74b0be0..b4a50f6 100644 --- a/resources/views/layout/site.blade.php +++ b/resources/views/layout/site.blade.php @@ -143,7 +143,7 @@