Fixed table migration, created api tests, created test env, added data import

This commit is contained in:
Gregorio Chiko Putra
2019-05-10 10:00:11 +07:00
parent e328b2ec1d
commit 019ac42b65
7 changed files with 487 additions and 23 deletions

View File

@@ -18,9 +18,11 @@ Route::post('/siswa', function (Request $request) {
// Auto redirect on fail
Validator::make($request->all(), [
'nama' => 'required|string',
'nisn' => 'required|integer',
'nisn' => 'required|regex:/^[0-9]+$/',
], [
'required' => 'Kolom :attribute harus diisi.',
'string' => 'Kolom :attribute tidak sesuai.',
'regex' => 'Kolom :attribute tidak sesuai.',
])->validate();
// Look for the given inputs in the resource
@@ -41,7 +43,7 @@ Route::post('/siswa', function (Request $request) {
Route::get('/access_log', function () {
// Get the number of unique access
$logs = App\AccessLog()->unique()->count();
$logs = App\AccessLog::all()->unique()->count();
// Get the total number of available resource
$resources = App\Siswa::count();