could you provide us what you've done with your code. maybe all you need is route model binding https://laravel.com/docs/5.3/routing#route-model-binding
passing URL parameters from one URL to another
Hi i am having a problem with passing URL parameters from one page URL to another URL. "http://localhost:8000/available/4" this is my first URL here i am passing the ID and getting another page with list of rows. i have one action in this page it is passing the id of that row. but i want to pass the id's of previous URL and the new URL is there anyway to do this? thanks in advance.
where are you passing this id? in controller or view?
if View: pass the current id from controller to view and then add that to the new URL using laravel helper..
if controller same thing.. not sure what the problem is?
This is my first view
@foreach($enqu as $enq )
<tr>
<td>{{ $enq->name}}</td>
<td>{{ "$enq->address1"}} {{ "$enq->address2"}}</td>
<td>{{ $enq->city}}</td>
<td>{{ $enq->customerstate}}</td>
<td>{{ $enq->phone}}</td>
<td>{{ $enq->created_at}}</td>
<td>@if($enq->enquiry_for == 1)
SAMRAT
@elseif ($enq->enquiry_for == 2)
YUVARAJ
@elseif ($enq->enquiry_for == 3)
MAHARAJ
@elseif ($enq->enquiry_for == 4)
SAMANTH
@elseif ($enq->enquiry_for == 5)
BHEEMA
@elseif ($enq->enquiry_for == 6)
DEALERSHIP
@elseif ($enq->enquiry_for == 7)
RAKSHAK
@endif </td>
<td>{{ $enq->quantity}}</td>
<td>{{ $enq->finished}}</td>
<td>@if($enq->language == 1)
English
@elseif ($enq->language == 2)
Telugu
@elseif ($enq->language == 3)
Kannada
@elseif ($enq->language == 4)
Tamil
@elseif ($enq->language == 5)
Hindi
@elseif ($enq->language == 6)
Marathi
@endif </td>
<td>@if($enq->enquired_through == 1)
Kisanraja Website
@elseif ($enq->enquired_through == 2)
Vinfinet Website
@elseif ($enq->enquired_through == 3)
Customer Care
@elseif ($enq->enquired_through == 4)
Toll free number
@elseif ($enq->enquired_through == 5)
Facebook
@elseif ($enq->enquired_through == 6)
You Tube
@elseif ($enq->enquired_through == 7)
Amazon
@elseif ($enq->enquired_through == 8)
Others
@endif </td>
<td>@if($enq->finished != $enq->quantity-1)<a href="<?php echo 'available/' .$enq->id ?>">Check Stock /</a>
@elseif($enq->finished == $enq->quantity-1)<a href="<?php echo 'availablefinal/' .$enq->id ?>">Check Stock /</a>
@endif
<a href="<?php echo 'passstatus/' .$enq->id ?>">Pending Order</a></td>
<td><a href="<?php echo 'passvalue/' .$enq->id ?>">Edit </a> / <a href="main.html"> Delete </a></td>
</tr>
@endforeach
and this is the controller for this view
public function available($id)
{
$term = DB::table('Enquiry')->where('id',$id)
->update(['order_status' => '2']);
$device = DB::table('device')->where('status', '2')
->get();
return view('pages.available', ['devices' => $device]);
}
and second view which is generating from the first controller is below
@foreach($devices as $device)
<tr>
<td>{{ $device->slno}}</td>
<td>@if($device->maharajsl == 0 && $device->device == 'SAMRAT')
SAMRAT
@elseif($device->maharajsl == 0 && $device->device == 'YUVARAJ')
YUVARAJ
@elseif($device->samanthsl!= 0)
SAMANTH
@elseif($device->maharajsl !=0)
MAHARAJ
@endif
</td>
<td>@if($device->device == 'SAMRAT')
{{ $device->language}}
@elseif ($device->device =='YUVARAJ')
-----
@endif</td>
<td><a href="<?php echo 'generate-invoice/' .$device->id ?>">Generate Invoice</a></td>
</tr>
@endforeach
and second controller
public function generate($id)
{
$row = DB::table('device')->where('id',$id)->first();
return view('pages.newinvoice')->with('row',$row);
}
i want the first id to get to the view which is generating by the second controller.
Please or to participate in this conversation.