modifié : SRC/app/Http/Controllers/ReferentController.php
modifié : SRC/app/Http/routes.php modifié : SRC/public/js/getListeOeuvre.js
This commit is contained in:
parent
d92ce6372d
commit
2a18c47789
@ -31,8 +31,8 @@ class ReferentController extends Controller {
|
||||
$me = User::current();
|
||||
$user = User::all();
|
||||
|
||||
// $ListeOeuvre = ListeOeuvre::find(1);
|
||||
// $ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
|
||||
//$ListeOeuvre = ListeOeuvre::find(2);
|
||||
//$ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]);
|
||||
|
||||
$listeoeuvres = ListeOeuvre::currentUser()->get();
|
||||
return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'listeoeuvres' => $listeoeuvres]);
|
||||
@ -83,7 +83,7 @@ class ReferentController extends Controller {
|
||||
|
||||
public function showListeOeuvres($id)
|
||||
{
|
||||
return Response::json(ListeOeuvre::currentUser()->get()[0]->oeuvres->toArray());
|
||||
return Response::json(ListeOeuvre::currentUser()->get()[1]->oeuvres->toArray());
|
||||
}
|
||||
|
||||
public function deleteListeOeuvre()
|
||||
|
@ -39,6 +39,7 @@ Route::group(['middleware' => 'auth'], function ()
|
||||
Route::post('deleteListeOeuvre', 'ReferentController@deleteListeOeuvre');
|
||||
Route::post('addListeOeuvre', 'ReferentController@addListeOeuvre');
|
||||
Route::get('showListOeuvres/{id}', 'ReferentController@showListeOeuvres');
|
||||
Route::get('setListOeuvres', 'ReferentController@setListOeuvres');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'admin'], function ()
|
||||
|
@ -3,11 +3,13 @@ $(document).ready( function() {
|
||||
$('.listeoeuvre').click(function() {
|
||||
url = "/showListOeuvres/" + $(this).children('.idListeOeuvre').val();
|
||||
$.get(url, function( data ) {
|
||||
if (data.length == 0 )
|
||||
$("#oeuvrePic").append("Aucune Oeuvre");
|
||||
data.forEach( function(el) {
|
||||
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">')
|
||||
.append('<a href="#" class="thumbnail">')
|
||||
.append('<img width="50px" src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>')
|
||||
.append('</a></div>');
|
||||
$("#oeuvrePic").append('<div class="col-xs-4 col-md-3">'
|
||||
+'<a href="#" class="thumbnail">'
|
||||
+'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>'
|
||||
+'</a></div>');
|
||||
})
|
||||
}, "json" )
|
||||
|
||||
|
Reference in New Issue
Block a user