modified: SRC/app/Http/Controllers/GameController.php
modified: SRC/app/Http/routes.php modified: SRC/app/Models/User.php
This commit is contained in:
parent
12a0a618a6
commit
b9202d2070
@ -28,6 +28,12 @@ class GameController extends Controller {
|
|||||||
return view('home',['referent' => $res]);
|
return view('home',['referent' => $res]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findReferents($reg) {
|
||||||
|
|
||||||
|
$res = User::referents()->name($reg)->get();
|
||||||
|
return Response::json($res->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show referent games
|
* Show referent games
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
Route::get('/', 'GameController@index');
|
Route::get('/', 'GameController@index');
|
||||||
Route::get('referents/{id}/games', 'GameController@showReferentGames')->where('id', '^((?!login|referent|admin).)*$');
|
Route::get('referents/{id}/games', 'GameController@showReferentGames')->where('id', '^((?!login|referent|admin).)*$');
|
||||||
Route::get('referents/{id}/games/{idGame}', 'GameController@showOneReferentGame');
|
Route::get('referents/{id}/games/{idGame}', 'GameController@showOneReferentGame');
|
||||||
|
Route::get('searchRef/{reg}', 'GameController@findReferents');
|
||||||
|
|
||||||
Route::get('password/reset/{token}', array(
|
Route::get('password/reset/{token}', array(
|
||||||
'uses' => 'LoginController@reset',
|
'uses' => 'LoginController@reset',
|
||||||
|
@ -39,4 +39,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||||||
{
|
{
|
||||||
return $query->where('droits', '0');
|
return $query->where('droits', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeName($query, $reg) {
|
||||||
|
return $query->where('firstname', 'like', '%'.$reg.'%')->orWhere('lastname', 'like', '%'.$reg.'%');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user