-
-
Save zach2825/afe41c5a3a0dcaaebf9bb1a42b3c91a0 to your computer and use it in GitHub Desktop.
Display select values with Laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function GetArticoli($IdUtente) | |
{ | |
// if you have a Articolo model. | |
$articoli = App\Articolo::where('IdUtente', '=', $IdUtente)->get(); | |
return view('gestionearticoli', compact('articoli')); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table id="mytable" class="table table-bordred table-striped"> | |
<thead> | |
<th>IdArticolo</th> | |
<th>Codice Articolo</th> | |
<th>Prezzo</th> | |
<th>Modifica</th> | |
<th>Elimina</th> | |
</thead> | |
<tbody> | |
@forelse ($articoli as $art) | |
<tr> | |
<td>{{$art->IdArticolo}}</td> | |
<td>{{$art->CodiceArticolo}}</td> | |
<td>{{$art->Prezzo}}</td> | |
<td> | |
<p data-placement='top' data-toggle='tooltip' title='Edit'> | |
<button class='btn btn-primary btn-xs' data-title='Edit' data-toggle='modal' data-target='#edit'><span class='glyphicon glyphicon-pencil'></span></button> | |
</p> | |
</td> | |
<td> | |
<p data-placement='top' data-toggle='tooltip' title='Delete'> | |
<button class='btn btn-danger btn-xs' data-title='Delete' data-toggle='modal' data-target='#delete'><span class='glyphicon glyphicon-trash'></span></button> | |
</p> | |
</td> | |
</tr> | |
@empty | |
<tr> | |
<td colspan="50">No Results</td> | |
</tr> | |
@endforelse | |
</tbody> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Route::get('/recuperoarticoliutente/{IdUtente}', 'Articolo@GetArticoli'); |
i have update original code
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, I set colspan of the output empty row to something really high it just expands to take up how many tags there are..