Aslam H
Aslam H

Reputation: 1801

passing urlencode laravel return 404

I try to pass url with two parameter but get error 404 which is bill_number include /

here is my route

Route::prefix("monthly-bill")->group(function() {
Route::get("slip/{id}/{bill_number}", "MonthlyBillController@slip");
});

when I generate url always return 404

url("apt/monthly-bill/slip/".$billing->bill_period_id."/".rawurlencode($billing->bill_number))

and this my controller

public function slip($bill_period_id, $bill_number)
{
    $convert = new Convert(storage_path("tenant\config\document\slip.blade.php"));

    $convert->data([
        "title" => "Document",
        "date" => date("d F Y"),
        "items" => MonthlyBill::info()
                    ->billPeriod($bill_period_id)
                    ->billNumber($bill_number)
                    ->select("monthly_bill.*",
                        "bpr.*", "t.name", "t.unit_kind", "t.width")->first()
    ]);

    $file = $convert->to("pdf", "invoice-$bill_period_id.pdf", true);

    return response()->file($file);
}

Upvotes: 0

Views: 234

Answers (1)

ljubadr
ljubadr

Reputation: 2254

I would suggest generating url with action() helper

action('MonthlyBillController@slip', [
    'id'          => $billing->bill_period_id,
    'bill_number' => $billing->bill_number,
])

Upvotes: 1

Related Questions