Hi i have problem when generate pdf report from laravel dom pdf?

|
skys215 2019-06-16 18:04:00
dont use shared host
and use git
daemon_coder 2019-06-16 18:04:57
skys215 2019-06-16 18:04:00
dont use shared host
and use git

Which hosting plan is better?

skys215 2019-06-16 18:05:47
use vultr, digitalocean or bandwagon for starting up, 5 dollars per month doesn’t cost much for me
daemon_coder 2019-06-16 18:08:04
skys215 2019-06-16 18:05:47
use vultr, digitalocean or bandwagon for starting up, 5 dollars per month doesn’t cost much for me

Thanks alot ✊

skys215 2019-06-16 18:08:58
if you need referral link, dm me
skys215 2019-06-16 18:09:04
(except for bandwagon
skys215 2019-06-16 18:10:04
your choice is open, you can also use aws or azure or any other vps
daemon_coder 2019-06-16 18:10:59
Am not upgrading now though
oxbir 2019-06-16 18:20:47
</div>
<div class=”card-footer”>
<button class=”btn btn-primary”>Is it ok?</button>
</div>
</div>
</form>

ReportController.php

public function show (Order $order)
{
return view(‘Home.report’, compact(‘order’));
}

public function store (Request $request)
{
$report = new Report($request->all());
$report->date = $request->date;
$report->time = $request->time;
$report->category_id = category_id;
$report->save();
}

oxbir 2019-06-16 18:20:47
Look at my codes.

web.php

Route::get(‘/internets’, ‘InternetController@index’)->name(‘internets’);
Route::post(‘/internets/store’, ‘InternetController@store’)->name(‘internets.store’);

Route::get(‘reports/show/{order}’, ‘ReportController@show’)->name(‘reports.show’);
Route::post(‘reports/store’, ‘ReportController@store’)->name(‘reports.store’);

InternetController.php

public function store(Request $request)
{
if (auth()->check()) {
$order = new Order($request->all());
$order->category_id = $request->category_id;
$order->user_id = auth()->user()->id;
$order->status = 0;
$order->description = $request->description;
$order->save();
alert()->success(‘ok’)->persistent(“ok”);
return redirect()->route(‘reports.show’, $order);
}
}

When I press save button. I see http://localhost:8000/reports/show/5 in address bar.

How to get this 5 for save the order.

show.blade.php

<form action=”{{ route(‘reports.store’) }}” method=”post”>
@csrf
<div class=”card”>
<div class=”table-responsive”>
<table class=”table”>
<thead>
<tr>
<th>first_name </th>
<th>last_name </th>
<th>mobile</th>
<th>city</th>
<th>category name</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ $order->user->first_name }}</td>
<td>{{ $order->user->last_name }}</td>
<td>{{ $order->user->mobile }}</td>
<td>{{ $order->user->city->city_name }}</td>
<td>{{ $order->categories->name }}</td>
</tr>
</tbody>
</table>
</div>
<div class=”card-body”>
<h3>Expert visit time</h3>
<div class=”row”>
<div class=”col-md-7″>
<div class=”input-group”>
<div class=”input-group-prepend”>
<span class=”input-group-text cursor-pointer” id=”date”>
<i class=”fas fa-calendar-alt”></i>
</span>
</div>
<div class=”row”>
<div class=”col-sm-6″>
<input type=”text” name=”date” id=”inputDate” class=”form-control” placeholder=”date” aria-label=”date” aria-describedby=”date”>
</div>
<div class=”col-md-6″>
<div class=”input-group date” id=”datetimepicker3″ data-target-input=”nearest”>
<input type=”text” name=”time” class=”form-control datetimepicker-input” data-target=”#datetimepicker3″/>
<div class=”input-group-append” data-target=”#datetimepicker3″ data-toggle=”datetimepicker”>
<div class=”input-group-text”><i class=”fas fa-clock”></i></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class=”col-md-5″>
<p class=”float-left m-0″>{{ $order->description }}</p>
</div>
</div>

skys215 2019-06-16 18:43:37
public function store(Request $request, $id){
dd($id);
}
skys215 2019-06-16 18:43:42
you will get the 5
oxbir 2019-06-16 19:07:01
skys215 2019-06-16 18:43:42
you will get the 5

No I get this error

oxbir 2019-06-16 19:07:12
Too few arguments to function AppHttpControllersReportController::store(), 1 passed and exactly 2 expected
skys215 2019-06-16 19:08:23
sorry, store function is for new data, you should add id on update function, not the store function
DesolatorMagno 2019-06-16 19:08:27
oxbir 2019-06-16 19:07:12
Too few arguments to function AppHttpControllersReportController::store(), 1 passed and exactly 2 expected

Yes that’s normal, look at the route, you have to send the id.

DesolatorMagno 2019-06-16 19:09:44
Exactly, you can’t expect to use id if you don’t send it, and in store you are creating a new, so the id is not necessary.
oxbir 2019-06-16 19:11:11
Route::post(‘reports/store/{id}’, ‘ReportController@store’)->name(‘reports.store’);
oxbir 2019-06-16 19:11:28
I added in web.php
oxbir 2019-06-16 19:11:46
Missing required parameters for [Route: reports.store] [URI: reports/store/{id}]. (View: C:xampphtdocsnewkhosravi-shopresourcesviewsHomereport.blade.php)
oxbir 2019-06-16 19:11:59
I get this error
DesolatorMagno 2019-06-16 19:12:21
Why you add the id to store function?
skys215 2019-06-16 19:13:19
I lead him mistakenly, it’s my fault
DesolatorMagno 2019-06-16 19:13:21
And you should read about restful, it could help you.
DesolatorMagno 2019-06-16 19:13:53
Ok ok.
oxbir 2019-06-16 19:13:58
DesolatorMagno 2019-06-16 19:12:21
Why you add the id to store function?

It is not necessary?

DesolatorMagno 2019-06-16 19:14:26
oxbir 2019-06-16 19:13:58
It is not necessary?

Ask yourself, why you need the id.

skys215 2019-06-16 19:14:55
(to save the data
DesolatorMagno 2019-06-16 19:14:56
Is easy to respond, the thing is that you should learn.
DesolatorMagno 2019-06-16 19:15:29
So ask, why or for what you use the id.
DesolatorMagno 2019-06-16 19:16:49
Or maybe you are confusing store with update?
oxbir 2019-06-16 19:16:58
Have you anydesk
oxbir 2019-06-16 19:17:50
Yes or no
DesolatorMagno 2019-06-16 19:24:02
No
loveycom 2019-06-16 21:42:52
oxbir 2019-06-16 19:16:58
Have you anydesk

Show the blade where save button is.

loveycom 2019-06-16 21:50:19
Also, according to your code structure, what you are getting is correct
loveycom 2019-06-16 21:52:45
You are getting url/reports/show/5 because you redirected to reports.show. According to your code 5 is the order ID passed to the route.

The question is, if this is not what you want, then what do you want to achieve?

temmyalex 2019-06-17 06:19:37
Hi i have problem when generate pdf report from laravel dom pdf? very slow and show error 500

can help me or share advice for fixed problem?

temmyalex 2019-06-17 06:20:41
Here is my code

public function print_pdf(Request $request)
{
$start_date = $request->start_date;
$end_date = $request->end_date;

$ppra = DB::select(‘EXEC SPGetPPRA ?,?’, array($start_date, $end_date));

$pdf = PDF::loadView(‘ppra.pdf’, compact(‘ppra’));
// $pdf->setPaper(‘a4’, ‘potrait’);
return $pdf->stream();
}

temmyalex 2019-06-17 06:20:51
Get data from stored procedure sql server
skys215 2019-06-17 06:23:02
temmyalex 2019-06-17 06:19:37
Hi i have problem when generate pdf report from laravel dom pdf? very slow and show error 500

can help me or share advice for fixed problem?

what’s the exact error? 500 it’s just error code
just like you tell doctor that you are ill, but you dont tell what you feel

temmyalex 2019-06-17 06:24:23
laravel_discuss-7325.jpg

DesolatorMagno 2019-06-17 06:25:09
temmyalex 2019-06-17 06:24:23

Lol, that’s a different way to “speak but say nothing”

DesolatorMagno 2019-06-17 06:25:38
That just means that something went wrong.
skys215 2019-06-17 06:26:08
Check the error in storage/logs/laravel.log
temmyalex 2019-06-17 06:26:19
Oke thanks @skys215
2019-06-17 20:02:58
Plz explain how to implement route and path
skys215 2019-06-17 20:03:18
I dont understand the question
2019-06-17 20:04:22
I mean in laravel how to understand route and path
2019-06-17 20:05:06
How to give route and when we give route
|