Skip to content

Commit

Permalink
Merge pull request #32 from alizul01/qa-test
Browse files Browse the repository at this point in the history
Qa test
  • Loading branch information
alizul01 authored Jun 17, 2023
2 parents da14a91 + 585fe77 commit f1421a8
Show file tree
Hide file tree
Showing 50 changed files with 467 additions and 548 deletions.
58 changes: 0 additions & 58 deletions .env.cypress

This file was deleted.

10 changes: 5 additions & 5 deletions .env.testing
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:hzQmAqI80nKjrSO3Tvka4MFUpW/HZHDSkkDFUkzoBtk=
APP_KEY=base64:BFzc3nu9K6xIcbL7zf4hCvAAKNYuqytP5ytdQgNmCTc=
APP_DEBUG=true
APP_URL=http://localhost

Expand All @@ -10,10 +10,10 @@ LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3307
DB_DATABASE=polarysdb_test
DB_PORT=3306
DB_DATABASE=polarysdb_testing
DB_USERNAME=root
DB_PASSWORD=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
Expand All @@ -34,7 +34,7 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="alizulfikar032@gmail.com"
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
Expand Down
94 changes: 49 additions & 45 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,54 @@

class AuthController extends Controller
{
public function login(Request $request)
{
$credentials = $request->only('email', 'password');

if (Auth::attempt($credentials)) {
$request->session()->regenerate();
toast()->success('Login success');
return redirect()->route('index');
} else {
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
}

public function register(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:8|confirmed',
'password_confirmation' => 'required|string|min:8',
'identity' => 'required|file|mimes:jpg,png,jpeg|max:2048',
]);

$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
'identity' => $request->file('identity')->store('public/identity'),
]);

Auth::login($user);

toast()->success('Register success');
return redirect()->route('index');
}

public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
toast()->success('Logout success');
return redirect()->route('login');
public function login(Request $request)
{
$request->validate([
'email' => 'required|email',
'password' => 'required',
]);

$credentials = $request->only('email', 'password');

if (Auth::attempt($credentials)) {
$request->session()->regenerate();
toast()->success('Login success');
return redirect()->route('index');
} else {
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
}


public function register(Request $request)
{
$request->validate([
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:8|confirmed',
'password_confirmation' => 'required|string|min:8',
// 'identity' => 'required|file|mimes:jpg,png,jpeg|max:2048',
]);

$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
// 'identity' => $request->file('identity')->store('public/identity'),
]);

toast()->success('Register success');
return redirect()->route('login');
}

public function logout(Request $request)
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
toast()->success('Logout success');
return redirect()->route('login');
}
}
2 changes: 0 additions & 2 deletions app/Http/Controllers/ReportingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ private function generateDocumentFromTemplate($template_path, $values)
{
$phpWord = new \PhpOffice\PhpWord\TemplateProcessor($template_path);
$phpWord->setValues($values);

// Your code to generate the document here...
$phpWord->setValues($values);
$phpWord->setImageValue('img', [
'path' => 'https://logodownload.org/wp-content/uploads/2017/10/Starbucks-logo.png',
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/RoomReservationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function postStep1(Request $request)
'start_date' => 'required',
'start_time' => 'required',
'end_time' => 'required|after:start_time',
'participant' => 'required',
'participant' => 'required|min:1',
'keterangan' => 'required',
]);
$validatedData['user_id'] = auth()->user()->id;
Expand Down
Binary file added cypress/downloads/360046_Pertemuan penting.docx
Binary file not shown.
Binary file added cypress/downloads/494189_Pertemuan penting.docx
Binary file not shown.
4 changes: 2 additions & 2 deletions database/migrations/2023_05_03_075637_create_users_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public function up(): void
$table->string('name');
$table->string('email');
$table->string("password");
$table->enum('role', ['admin', 'user', 'superadmin', 'bem', 'kajur', 'hmti']);
$table->string('identity');
$table->enum('role', ['user', 'superadmin', 'bem', 'kajur', 'hmti'])->default('user');
$table->string('identity')->nullable();
$table->foreignId('organization_id')->nullable();
$table->timestamps();
});
Expand Down
13 changes: 13 additions & 0 deletions database/seeders/RoomReservationSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Database\Seeders;

use App\Models\RoomReservation;
use Carbon\Carbon;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

Expand All @@ -13,6 +14,18 @@ class RoomReservationSeeder extends Seeder
*/
public function run(): void
{
$reservations = [
'user_id' => 5,
'room_id' => 1,
'start_date' => Carbon::now(),
'start_time' => '09:00:00',
'end_time' => '12:00:00',
'keterangan' => 'Pertemuan penting',
'participant' => 35,
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
];

RoomReservation::create($reservations);
}
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"devDependencies": {
"autoprefixer": "^10.4.14",
"axios": "^1.4.0",
"cypress": "^12.13.0",
"cypress-file-upload": "^5.0.8",
"cypress": "^12.14.0",
"flowbite": "^1.6.5",
"laravel-vite-plugin": "^0.7.8",
"postcss": "^8.4.24",
Expand All @@ -18,6 +17,7 @@
"vite": "^4.3.9"
},
"dependencies": {
"cypress-file-upload": "^5.0.8",
"sweetalert2": "^11.7.12"
}
}
Loading

0 comments on commit f1421a8

Please sign in to comment.