-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from RiwRiwara/main
Update Production
- Loading branch information
Showing
77 changed files
with
2,099 additions
and
654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,8 @@ | |
namespace App\Constants; | ||
|
||
|
||
class Districts{ | ||
class Districts | ||
{ | ||
|
||
const DISTRICT = [ | ||
[ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\User; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Resources\UserResource; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Log; | ||
use App\Models\User; | ||
|
||
class GetUserByIdController extends Controller | ||
{ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
public function __invoke(Request $request) | ||
{ | ||
return $this->getUserByID($request); | ||
} | ||
|
||
public function getUserByID(string $user_id) | ||
{ | ||
$user = User::where('user_id', $user_id)->first(); | ||
if ($user) { | ||
return response()->json([ | ||
'message' => 'User found', | ||
'user' => new UserResource($user) | ||
], 200); | ||
} else { | ||
return response()->json([ | ||
'message' => 'User not found' | ||
], 404); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\User; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Resources\UserResource; | ||
use Illuminate\Http\Request; | ||
use App\Models\User; | ||
|
||
class UpdateByFieldsName extends Controller | ||
{ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
public function __invoke(Request $request) | ||
{ | ||
return $this->updateByFieldsName($request); | ||
} | ||
|
||
public function updateByFieldsName(Request $request) | ||
{ | ||
$user = User::where('user_id', $request->user_id)->first(); | ||
|
||
if ($user) { | ||
|
||
$user->update($request->all()); | ||
return response()->json([ | ||
'message' => 'User updated', | ||
'user' => new UserResource($user) | ||
], 200); | ||
|
||
} else { | ||
return response()->json([ | ||
'message' => 'User not found' | ||
], 404); | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
app/Http/Controllers/Api/User/UploadUserProfileController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\User; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Storage; | ||
use Intervention\Image\Laravel\Facades\Image; | ||
use App\Models\User; | ||
use App\Services\AzureBlobService; | ||
|
||
|
||
class UploadUserProfileController extends Controller | ||
{ | ||
|
||
public function __construct() | ||
{ | ||
// | ||
} | ||
public function __invoke(Request $request) | ||
{ | ||
} | ||
|
||
public function uploadUserProfile(Request $request) | ||
{ | ||
try { | ||
$image_tmp = json_decode($request->input('image'), true); | ||
} catch (\Exception $e) { | ||
toastr()->addError('Error uploading image'); | ||
return redirect()->back(); | ||
} | ||
try { | ||
$path = Storage::path($image_tmp['path']); | ||
$image = Image::read($path)->toWebp(); | ||
|
||
$blobService = new AzureBlobService(); | ||
$containerName = 'testprofileimgs'; | ||
$blobName = auth()->user()->user_id . '_' . now() . '.webp'; | ||
|
||
$decodeImage = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image->toDataUri())); | ||
|
||
$blobService->uploadBlob($containerName, $blobName, $decodeImage, $image->mediaType()); | ||
|
||
// delete temp image | ||
Storage::deleteDirectory('tmp'); | ||
|
||
// delete old image | ||
$blobService->deleteBlob($containerName, auth()->user()->profile_img); | ||
|
||
// update User profile image | ||
$user = User::where('user_id', auth()->user()->user_id)->first(); | ||
$user->profile_img = $blobName; | ||
$user->save(); | ||
|
||
|
||
return response()->json([ | ||
'message' => 'Profile image uploaded', | ||
'user' => $user | ||
], 200); | ||
} catch (\Exception $e) { | ||
return response()->json([ | ||
'message' => 'Error uploading image', 'error' => $e->getMessage() | ||
], 500); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/Http/Controllers/Event/CreateEvent/CreateEventController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Event\CreateEvent; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class CreateEventController extends Controller | ||
{ | ||
public function __invoke(Request $request) | ||
{ | ||
$page_data = [ | ||
'breadcrumbItems' => [ | ||
['label' => 'Events', 'url' => route('create-event')], | ||
['label' => 'Create Eevnt'], | ||
], | ||
'event_types' => \App\Models\EventType::all(), | ||
'badge_types' => \App\Models\Badge::all(), | ||
]; | ||
return view('logged_in.create_event', compact('page_data'),); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/Http/Controllers/Event/EventList/EventListController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Event\EventList; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
|
||
class EventListController extends Controller | ||
{ | ||
public function __invoke(Request $request) | ||
{ | ||
$page_data = [ | ||
'breadcrumbItems' => [ | ||
['label' => 'Events', 'url' => route('create-event')], | ||
['label' => 'Create Event'], | ||
] | ||
]; | ||
|
||
return view('logged_in.event-list', compact('page_data')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.