modified: SRC/app/Http/Controllers/GameController.php

modified:   SRC/app/Http/routes.php
	modified:   SRC/app/Models/User.php
This commit is contained in:
Malibu 2015-03-10 16:10:52 +01:00
parent 12a0a618a6
commit b9202d2070
3 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,12 @@ class GameController extends Controller {
return view('home',['referent' => $res]);
}
public function findReferents($reg) {
$res = User::referents()->name($reg)->get();
return Response::json($res->toArray());
}
/**
* Show referent games
*

View File

@ -15,6 +15,7 @@
Route::get('/', 'GameController@index');
Route::get('referents/{id}/games', 'GameController@showReferentGames')->where('id', '^((?!login|referent|admin).)*$');
Route::get('referents/{id}/games/{idGame}', 'GameController@showOneReferentGame');
Route::get('searchRef/{reg}', 'GameController@findReferents');
Route::get('password/reset/{token}', array(
'uses' => 'LoginController@reset',

View File

@ -39,4 +39,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
{
return $query->where('droits', '0');
}
public function scopeName($query, $reg) {
return $query->where('firstname', 'like', '%'.$reg.'%')->orWhere('lastname', 'like', '%'.$reg.'%');
}
}