From 1f16d97ca9b2bb04d8d3bcae299d560882d01c29 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 28 Apr 2015 11:18:47 +0200 Subject: [PATCH] ajout de allUsers --- service/app/Http/Controllers/UserController.php | 7 ++++++- service/app/Http/routes.php | 5 +---- service/resources/views/user.blade.php | 9 +-------- service/resources/views/userAll.blade.php | 7 +++++++ 4 files changed, 15 insertions(+), 13 deletions(-) create mode 100644 service/resources/views/userAll.blade.php diff --git a/service/app/Http/Controllers/UserController.php b/service/app/Http/Controllers/UserController.php index 9a2a37d..1354f6e 100644 --- a/service/app/Http/Controllers/UserController.php +++ b/service/app/Http/Controllers/UserController.php @@ -15,9 +15,14 @@ class UserController extends Controller { */ public function showProfile($id) { + $user = User::find($id); + return view('user', ['user' => $user]); + } + public function getAllProfile() + { $users = User::all(); - return view('user', ['user' => $id, 'users' => $users]); + return view('userAll', ['users' => $users]); } } diff --git a/service/app/Http/routes.php b/service/app/Http/routes.php index 0c71fb0..21fd579 100644 --- a/service/app/Http/routes.php +++ b/service/app/Http/routes.php @@ -21,8 +21,5 @@ return 'user'; }); -$app->get('user/{id}', function($id){ - return 'user'+$id; -}); - $app->get('user/{id}', 'App\Http\Controllers\UserController@showProfile'); +$app->get('users', 'App\Http\Controllers\UserController@getAllProfile'); diff --git a/service/resources/views/user.blade.php b/service/resources/views/user.blade.php index 84b2fc9..ac080d7 100644 --- a/service/resources/views/user.blade.php +++ b/service/resources/views/user.blade.php @@ -1,14 +1,7 @@ @extends('layouts.master') -@section('title', 'Page Title') - -@section('sidebar') - @parent - -

This is appended to the master sidebar.

-@stop +@section('title', 'User') @section('content')

{{$user}}

-

{{$users}}

@stop diff --git a/service/resources/views/userAll.blade.php b/service/resources/views/userAll.blade.php new file mode 100644 index 0000000..068411a --- /dev/null +++ b/service/resources/views/userAll.blade.php @@ -0,0 +1,7 @@ +@extends('layouts.master') + +@section('title', 'All Users') + +@section('content') +

{{$users}}

+@stop