I have 2 table which are product and ps(seller). I want to make a page which will list all the seller product. Im using if else statement but it not working. Im quite new in laravel , please help me.
PsController.php
public function show(){
$ps = DB::table('ps')->get();
return view('viewps', ['ps' => $ps]);
}
public function view($id){
$ps = Ps::find($id)
return view ('views')->with('ps', $ps);
}
public function sellitem(){
$id = DB::table('ps')->get();
$ps_id = DB::table('product')->get();
return view('sellitem', ['ps_id' => $ps_id,'id'=>$id]);
}
sellitem.blade.php
@if ($ps_id == $id)
<div class="searchable-container">
<div class="items col-xs-12 col-sm-6 col-md-6 col-lg-6 clearfix">
<div class="info-block block-info clearfix">
<div class="square-box pull-left">
<span class="glyphicon glyphicon-user glyphicon-lg"></span>
</div>
<h5></h5>
<h5><img src="" height="100" width="100"/> </h5>
<h5>Sold by : </h5>
<h4> <div class="panel-body"> </h4>
</div>
</div>
@else
No records found !
@endif
Route::get('/viewps', 'PsController@show');
Route::get('/viewps/{id}', 'PsController@view')->name('view');
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/sellitem/{ps_id}', 'PsController@sellitem')->name('sellitem');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire