Compare commits

...

No commits in common. "main" and "integration" have entirely different histories.

188 changed files with 36846 additions and 1 deletions

18
.editorconfig Normal file
View File

@ -0,0 +1,18 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2
[docker-compose.yml]
indent_size = 4

69
.env.example Normal file
View File

@ -0,0 +1,69 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:XezKe3raFggOy5el7fSP8dIJ/tMs5h9XZXDnsb9yfMM=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US
APP_MAINTENANCE_DRIVER=file
# APP_MAINTENANCE_STORE=database
PHP_CLI_SERVER_WORKERS=4
BCRYPT_ROUNDS=12
LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=db_mysql
DB_PORT=3306
DB_DATABASE=laravel-cms
DB_USERNAME=laravel_user
DB_PASSWORD=password
SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null
BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
CACHE_STORE=database
CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1
REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=log
MAIL_SCHEME=null
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"

11
.gitattributes vendored Normal file
View File

@ -0,0 +1,11 @@
* text=auto eol=lf
*.blade.php diff=html
*.css diff=css
*.html diff=html
*.md diff=markdown
*.php diff=php
/.github export-ignore
CHANGELOG.md export-ignore
.styleci.yml export-ignore

23
.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/storage/pail
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/auth.json
/.fleet
/.idea
/.nova
/.vscode
/.zed

View File

@ -1,2 +1,66 @@
# cms-frontend <p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
<p align="center">
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the [Laravel Partners program](https://partners.laravel.com).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[WebReinvent](https://webreinvent.com/)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[DevSquad](https://devsquad.com/hire-laravel-developers)**
- **[Jump24](https://jump24.co.uk)**
- **[Redberry](https://redberry.international/laravel/)**
- **[Active Logic](https://activelogic.com)**
- **[byte5](https://byte5.de)**
- **[OP.GG](https://op.gg)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
class AuthController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function login(Request $request)
{
$credentials = $request->validate([
'email' => 'required|email',
'password' => 'required',
]);
try {
$response = $this->apiService->post('/auth/login', $credentials);
if ($response->successful()) {
$data = $response->json();
session(['api_token' => $data['token']]);
return redirect()->intended('/dashboard');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
} catch (\Exception $e) {
return back()->withErrors([
'error' => 'Unable to connect to the authentication service.',
]);
}
}
public function logout()
{
try {
$this->apiService->post('/auth/logout');
} catch (\Exception $e) {
// Log the error but proceed with local logout
}
Session::forget('api_token');
return redirect('/login');
}
}

View File

@ -0,0 +1,175 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class CardMemberController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/card-members');
if ($response->successful()) {
return view('pages.member management.card-member', [
'members' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch card members.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'card_number' => 'required|string|unique:card_members,card_number',
'member_type' => 'required|string',
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'email' => 'required|email|unique:card_members,email',
'phone' => 'required|string',
'birth_date' => 'required|date',
'address' => 'required|string',
'city' => 'required|string',
'state' => 'required|string',
'postal_code' => 'required|string',
'status' => 'required|string|in:active,inactive,locked'
]);
try {
$response = $this->apiService->post('/card-members', $validated);
if ($response->successful()) {
return redirect()->route('card-member')
->with('success', 'Card member created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create card member.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'member_type' => 'required|string',
'first_name' => 'required|string|max:255',
'last_name' => 'required|string|max:255',
'email' => 'required|email|unique:card_members,email,'.$id,
'phone' => 'required|string',
'birth_date' => 'required|date',
'address' => 'required|string',
'city' => 'required|string',
'state' => 'required|string',
'postal_code' => 'required|string',
'status' => 'required|string|in:active,inactive,locked'
]);
try {
$response = $this->apiService->put("/card-members/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('card-member')
->with('success', 'Card member updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update card member.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/card-members/{$id}");
if ($response->successful()) {
return redirect()->route('card-member')
->with('success', 'Card member deleted successfully.');
}
return back()->with('error', 'Unable to delete card member.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function lockAccount($id)
{
try {
$response = $this->apiService->post("/card-members/{$id}/lock");
if ($response->successful()) {
return redirect()->route('card-member')
->with('success', 'Account locked successfully.');
}
return back()->with('error', 'Unable to lock account.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function unlockAccount($id)
{
try {
$response = $this->apiService->post("/card-members/{$id}/unlock");
if ($response->successful()) {
return redirect()->route('card-member')
->with('success', 'Account unlocked successfully.');
}
return back()->with('error', 'Unable to unlock account.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function getLockedAccounts()
{
try {
$response = $this->apiService->get('/card-members/locked');
if ($response->successful()) {
return view('pages.member management.locked-accounts', [
'lockedAccounts' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch locked accounts.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function getTransactionHistory($id)
{
try {
$response = $this->apiService->get("/card-members/{$id}/transactions");
if ($response->successful()) {
return response()->json($response->json());
}
return response()->json(['error' => 'Unable to fetch transaction history'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,201 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class FuelPriceController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function onDemand()
{
try {
$response = $this->apiService->get('/fuel-prices/current');
$stationsResponse = $this->apiService->get('/stations');
$fuelTypesResponse = $this->apiService->get('/fuel-types');
if ($response->successful() && $stationsResponse->successful() && $fuelTypesResponse->successful()) {
return view('pages.fuel-price-on-demand', [
'prices' => $response->json()['data'],
'stations' => $stationsResponse->json()['data'],
'fuelTypes' => $fuelTypesResponse->json()['data']
]);
}
return back()->with('error', 'Unable to fetch fuel prices.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function updateOnDemand(Request $request)
{
$validated = $request->validate([
'prices' => 'required|array',
'prices.*.*' => 'nullable|numeric|min:0'
]);
try {
$response = $this->apiService->post('/fuel-prices/update', $validated);
if ($response->successful()) {
return redirect()->route('fuel-price.on-demand')
->with('success', 'Fuel prices updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update fuel prices.');
}
}
public function importPrices(Request $request)
{
$request->validate([
'csv_file' => 'required|file|mimes:csv,txt'
]);
try {
$response = $this->apiService->post('/fuel-prices/import', [
'file' => $request->file('csv_file')
], true);
if ($response->successful()) {
return redirect()->route('fuel-price.on-demand')
->with('success', 'Fuel prices imported successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to import fuel prices.');
}
}
public function exportPrices()
{
try {
$response = $this->apiService->get('/fuel-prices/export');
if ($response->successful()) {
return response()->streamDownload(
function () use ($response) {
echo $response->body();
},
'fuel-prices.csv'
);
}
return back()->with('error', 'Unable to export fuel prices.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function schedule()
{
try {
$response = $this->apiService->get('/fuel-prices/schedule');
$stationsResponse = $this->apiService->get('/stations');
$fuelTypesResponse = $this->apiService->get('/fuel-types');
if ($response->successful() && $stationsResponse->successful() && $fuelTypesResponse->successful()) {
return view('pages.fuel-price-schedule', [
'schedules' => $response->json()['data'],
'stations' => $stationsResponse->json()['data'],
'fuelTypes' => $fuelTypesResponse->json()['data']
]);
}
return back()->with('error', 'Unable to fetch scheduled updates.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function storeSchedule(Request $request)
{
$validated = $request->validate([
'station_id' => 'required|integer',
'fuel_type_id' => 'required|integer',
'new_price' => 'required|numeric|min:0',
'scheduled_for' => 'required|date|after:now'
]);
try {
$response = $this->apiService->post('/fuel-prices/schedule', $validated);
if ($response->successful()) {
return redirect()->route('fuel-price.schedule')
->with('success', 'Price update scheduled successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to schedule price update.');
}
}
public function updateSchedule(Request $request, $id)
{
$validated = $request->validate([
'station_id' => 'required|integer',
'fuel_type_id' => 'required|integer',
'new_price' => 'required|numeric|min:0',
'scheduled_for' => 'required|date|after:now'
]);
try {
$response = $this->apiService->put("/fuel-prices/schedule/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('fuel-price.schedule')
->with('success', 'Scheduled update modified successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to modify scheduled update.');
}
}
public function deleteSchedule($id)
{
try {
$response = $this->apiService->delete("/fuel-prices/schedule/{$id}");
if ($response->successful()) {
return redirect()->route('fuel-price.schedule')
->with('success', 'Scheduled update deleted successfully.');
}
return back()->with('error', 'Unable to delete scheduled update.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function logs()
{
try {
$response = $this->apiService->get('/fuel-prices/logs');
if ($response->successful()) {
return view('pages.fuel-price-update-logs', [
'logs' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch update logs.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class NotificationsController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/notifications');
if ($response->successful()) {
return view('pages.notification', [
'notifications' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch notifications.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'message' => 'required|string',
'type' => 'required|string',
'target_users' => 'required|array',
'schedule_date' => 'nullable|date',
'status' => 'required|string|in:draft,scheduled,sent'
]);
try {
$response = $this->apiService->post('/notifications', $validated);
if ($response->successful()) {
return redirect()->route('notification')
->with('success', 'Notification created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create notification.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'message' => 'required|string',
'type' => 'required|string',
'target_users' => 'required|array',
'schedule_date' => 'nullable|date',
'status' => 'required|string|in:draft,scheduled,sent'
]);
try {
$response = $this->apiService->put("/notifications/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('notification')
->with('success', 'Notification updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update notification.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/notifications/{$id}");
if ($response->successful()) {
return redirect()->route('notification')
->with('success', 'Notification deleted successfully.');
}
return back()->with('error', 'Unable to delete notification.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function batchDestroy(Request $request)
{
$ids = $request->validate([
'ids' => 'required|array',
'ids.*' => 'required|integer'
]);
try {
$response = $this->apiService->post("/notifications/batch-delete", $ids);
if ($response->successful()) {
return response()->json(['message' => 'Notifications deleted successfully']);
}
return response()->json(['error' => 'Unable to delete notifications'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,137 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class PhotoSliderController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/photo-sliders');
if ($response->successful()) {
return view('pages.home page.photo-slider', [
'sliders' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch photo sliders.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'image' => 'required|image|mimes:jpeg,png,jpg|max:2048',
'order' => 'required|integer|min:1',
'status' => 'required|string|in:active,inactive',
'link_url' => 'nullable|url',
'start_date' => 'required|date',
'end_date' => 'required|date|after:start_date'
]);
try {
// Handle file upload
if ($request->hasFile('image')) {
$path = $request->file('image')->store('photo-sliders', 'public');
$validated['image_path'] = $path;
}
$response = $this->apiService->post('/photo-sliders', $validated);
if ($response->successful()) {
return redirect()->route('photo-slider')
->with('success', 'Photo slider created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create photo slider.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'description' => 'nullable|string',
'image' => 'nullable|image|mimes:jpeg,png,jpg|max:2048',
'order' => 'required|integer|min:1',
'status' => 'required|string|in:active,inactive',
'link_url' => 'nullable|url',
'start_date' => 'required|date',
'end_date' => 'required|date|after:start_date'
]);
try {
// Handle file upload if new image is provided
if ($request->hasFile('image')) {
$path = $request->file('image')->store('photo-sliders', 'public');
$validated['image_path'] = $path;
}
$response = $this->apiService->put("/photo-sliders/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('photo-slider')
->with('success', 'Photo slider updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update photo slider.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/photo-sliders/{$id}");
if ($response->successful()) {
return redirect()->route('photo-slider')
->with('success', 'Photo slider deleted successfully.');
}
return back()->with('error', 'Unable to delete photo slider.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function updateOrder(Request $request)
{
$validated = $request->validate([
'orders' => 'required|array',
'orders.*.id' => 'required|integer',
'orders.*.order' => 'required|integer|min:1'
]);
try {
$response = $this->apiService->post("/photo-sliders/reorder", $validated);
if ($response->successful()) {
return response()->json(['message' => 'Order updated successfully']);
}
return response()->json(['error' => 'Unable to update order'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class PromotionsController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/promotions');
if ($response->successful()) {
return view('pages.promotions', [
'promotions' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch promotions.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'type' => 'required|string',
'startDate' => 'required|date',
'endDate' => 'required|date|after:startDate',
'description' => 'nullable|string',
'terms_conditions' => 'nullable|string',
]);
try {
$response = $this->apiService->post('/promotions', $validated);
if ($response->successful()) {
return redirect()->route('promotions')
->with('success', 'Promotion created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create promotion.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'type' => 'required|string',
'startDate' => 'required|date',
'endDate' => 'required|date|after:startDate',
'description' => 'nullable|string',
'terms_conditions' => 'nullable|string',
]);
try {
$response = $this->apiService->put("/promotions/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('promotions')
->with('success', 'Promotion updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update promotion.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/promotions/{$id}");
if ($response->successful()) {
return redirect()->route('promotions')
->with('success', 'Promotion deleted successfully.');
}
return back()->with('error', 'Unable to delete promotion.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function batchDestroy(Request $request)
{
$ids = $request->validate([
'ids' => 'required|array',
'ids.*' => 'required|integer'
]);
try {
$response = $this->apiService->post("/promotions/batch-delete", $ids);
if ($response->successful()) {
return response()->json(['message' => 'Promotions deleted successfully']);
}
return response()->json(['error' => 'Unable to delete promotions'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,136 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class ReportsController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function registrationReport(Request $request)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'member_type' => 'nullable|string'
]);
try {
$response = $this->apiService->get('/reports/registrations', $filters);
if ($response->successful()) {
return view('pages.reports.registration-report', [
'report' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch registration report.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function topUpUsageReport(Request $request)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'payment_method' => 'nullable|string'
]);
try {
$response = $this->apiService->get('/reports/top-up-usage', $filters);
if ($response->successful()) {
return view('pages.reports.top-up-usage-report', [
'report' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch top-up usage report.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function mobileUsageReport(Request $request)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'platform' => 'nullable|string'
]);
try {
$response = $this->apiService->get('/reports/mobile-usage', $filters);
if ($response->successful()) {
return view('pages.reports.mobile-usage-report', [
'report' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch mobile usage report.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function stationRatingReport(Request $request)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'station_id' => 'nullable|integer',
'rating' => 'nullable|integer|min:1|max:5'
]);
try {
$response = $this->apiService->get('/reports/station-ratings', $filters);
if ($response->successful()) {
return view('pages.reports.station-rating-report', [
'report' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch station rating report.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function exportReport(Request $request, $reportType)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'format' => 'required|string|in:csv,excel,pdf'
]);
try {
$response = $this->apiService->get("/reports/{$reportType}/export", $filters);
if ($response->successful()) {
return response()->streamDownload(
function () use ($response) {
echo $response->body();
},
"report.{$filters['format']}"
);
}
return back()->with('error', 'Unable to export report.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
}

View File

@ -0,0 +1,148 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class StationController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/stations');
if ($response->successful()) {
return view('pages.station locator.stations', [
'stations' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch stations.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'address' => 'required|string',
'city' => 'required|string',
'state' => 'required|string',
'postal_code' => 'required|string',
'latitude' => 'required|numeric',
'longitude' => 'required|numeric',
'contact_number' => 'required|string',
'operating_hours' => 'required|string',
'services' => 'required|array',
'status' => 'required|string|in:active,inactive,maintenance'
]);
try {
$response = $this->apiService->post('/stations', $validated);
if ($response->successful()) {
return redirect()->route('stations')
->with('success', 'Station created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create station.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'address' => 'required|string',
'city' => 'required|string',
'state' => 'required|string',
'postal_code' => 'required|string',
'latitude' => 'required|numeric',
'longitude' => 'required|numeric',
'contact_number' => 'required|string',
'operating_hours' => 'required|string',
'services' => 'required|array',
'status' => 'required|string|in:active,inactive,maintenance'
]);
try {
$response = $this->apiService->put("/stations/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('stations')
->with('success', 'Station updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update station.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/stations/{$id}");
if ($response->successful()) {
return redirect()->route('stations')
->with('success', 'Station deleted successfully.');
}
return back()->with('error', 'Unable to delete station.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function updateFuelPrices(Request $request, $id)
{
$validated = $request->validate([
'fuel_prices' => 'required|array',
'fuel_prices.*.fuel_type' => 'required|string',
'fuel_prices.*.price' => 'required|numeric|min:0',
'effective_date' => 'required|date'
]);
try {
$response = $this->apiService->post("/stations/{$id}/fuel-prices", $validated);
if ($response->successful()) {
return redirect()->route('stations')
->with('success', 'Fuel prices updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update fuel prices.');
}
}
public function getFuelPriceHistory($id)
{
try {
$response = $this->apiService->get("/stations/{$id}/fuel-price-history");
if ($response->successful()) {
return response()->json($response->json());
}
return response()->json(['error' => 'Unable to fetch fuel price history'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class SystemParameterController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/system-parameters');
if ($response->successful()) {
return view('pages.system-parameters', [
'parameters' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch system parameters.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255|unique:system_parameters,name',
'value' => 'required|string',
'type' => 'required|string|in:String,Number,Boolean,JSON',
'description' => 'required|string'
]);
try {
// Format value based on type
$validated['value'] = $this->formatValue($validated['value'], $validated['type']);
$response = $this->apiService->post('/system-parameters', $validated);
if ($response->successful()) {
return redirect()->route('system-parameters')
->with('success', 'System parameter created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create system parameter.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'name' => 'required|string|max:255|unique:system_parameters,name,'.$id,
'value' => 'required|string',
'type' => 'required|string|in:String,Number,Boolean,JSON',
'description' => 'required|string'
]);
try {
// Format value based on type
$validated['value'] = $this->formatValue($validated['value'], $validated['type']);
$response = $this->apiService->put("/system-parameters/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('system-parameters')
->with('success', 'System parameter updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update system parameter.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/system-parameters/{$id}");
if ($response->successful()) {
return redirect()->route('system-parameters')
->with('success', 'System parameter deleted successfully.');
}
return back()->with('error', 'Unable to delete system parameter.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
protected function formatValue($value, $type)
{
switch ($type) {
case 'Number':
return is_numeric($value) ? (float) $value : $value;
case 'Boolean':
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
case 'JSON':
return is_string($value) && json_decode($value) ? $value : json_encode($value);
default:
return (string) $value;
}
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class TopUpController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/top-ups');
if ($response->successful()) {
return view('pages.top-up', [
'topUps' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch top-up records.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'member_id' => 'required|string',
'amount' => 'required|numeric|min:0',
'payment_method' => 'required|string',
'reference_number' => 'required|string|unique:top_ups,reference_number',
'status' => 'required|string|in:pending,completed,failed',
'notes' => 'nullable|string'
]);
try {
$response = $this->apiService->post('/top-ups', $validated);
if ($response->successful()) {
return redirect()->route('top-up')
->with('success', 'Top-up transaction created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create top-up transaction.');
}
}
public function getSettings()
{
try {
$response = $this->apiService->get('/top-up-settings');
if ($response->successful()) {
return view('pages.top-up-settings', [
'settings' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch top-up settings.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function updateSettings(Request $request)
{
$validated = $request->validate([
'min_amount' => 'required|numeric|min:0',
'max_amount' => 'required|numeric|min:0|gt:min_amount',
'allowed_payment_methods' => 'required|array',
'processing_fee' => 'required|numeric|min:0',
'is_enabled' => 'required|boolean'
]);
try {
$response = $this->apiService->put('/top-up-settings', $validated);
if ($response->successful()) {
return redirect()->route('top-up-settings')
->with('success', 'Top-up settings updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update top-up settings.');
}
}
public function getTransactionHistory(Request $request)
{
$filters = $request->validate([
'start_date' => 'nullable|date',
'end_date' => 'nullable|date|after_or_equal:start_date',
'status' => 'nullable|string|in:pending,completed,failed',
'payment_method' => 'nullable|string'
]);
try {
$response = $this->apiService->get('/top-ups/history', $filters);
if ($response->successful()) {
return response()->json($response->json());
}
return response()->json(['error' => 'Unable to fetch transaction history'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class TopUpSettingController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/top-up-settings');
if ($response->successful()) {
return view('pages.top-up-settings', [
'settings' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch top-up settings.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255|unique:top_up_settings,name',
'value' => 'required|numeric|min:0',
'description' => 'required|string',
'type' => 'required|string|in:minimum,maximum,fee,bonus',
'status' => 'required|boolean'
]);
try {
$response = $this->apiService->post('/top-up-settings', $validated);
if ($response->successful()) {
return redirect()->route('top-up-settings')
->with('success', 'Top-up setting created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create top-up setting.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'name' => 'required|string|max:255|unique:top_up_settings,name,'.$id,
'value' => 'required|numeric|min:0',
'description' => 'required|string',
'type' => 'required|string|in:minimum,maximum,fee,bonus',
'status' => 'required|boolean'
]);
try {
$response = $this->apiService->put("/top-up-settings/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('top-up-settings')
->with('success', 'Top-up setting updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update top-up setting.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/top-up-settings/{$id}");
if ($response->successful()) {
return redirect()->route('top-up-settings')
->with('success', 'Top-up setting deleted successfully.');
}
return back()->with('error', 'Unable to delete top-up setting.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function batchUpdate(Request $request)
{
$validated = $request->validate([
'settings' => 'required|array',
'settings.*.id' => 'required|integer',
'settings.*.value' => 'required|numeric|min:0',
'settings.*.status' => 'required|boolean'
]);
try {
$response = $this->apiService->post('/top-up-settings/batch-update', $validated);
if ($response->successful()) {
return response()->json(['message' => 'Settings updated successfully']);
}
return response()->json(['error' => 'Unable to update settings'], 400);
} catch (\Exception $e) {
return response()->json(['error' => 'Service unavailable'], 503);
}
}
}

View File

@ -0,0 +1,93 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Services\Api\ApiService;
use Illuminate\Http\Request;
class UserController extends Controller
{
protected ApiService $apiService;
public function __construct(ApiService $apiService)
{
$this->apiService = $apiService;
}
public function index()
{
try {
$response = $this->apiService->get('/users');
if ($response->successful()) {
return view('users.index', [
'users' => $response->json()['data']
]);
}
return back()->with('error', 'Unable to fetch users.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
public function store(Request $request)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|max:255',
'password' => 'required|min:8',
]);
try {
$response = $this->apiService->post('/users', $validated);
if ($response->successful()) {
return redirect()->route('users.index')
->with('success', 'User created successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to create user.');
}
}
public function update(Request $request, $id)
{
$validated = $request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|max:255',
]);
try {
$response = $this->apiService->put("/users/{$id}", $validated);
if ($response->successful()) {
return redirect()->route('users.index')
->with('success', 'User updated successfully.');
}
return back()->withErrors($response->json()['errors']);
} catch (\Exception $e) {
return back()->with('error', 'Unable to update user.');
}
}
public function destroy($id)
{
try {
$response = $this->apiService->delete("/users/{$id}");
if ($response->successful()) {
return redirect()->route('users.index')
->with('success', 'User deleted successfully.');
}
return back()->with('error', 'Unable to delete user.');
} catch (\Exception $e) {
return back()->with('error', 'Service unavailable.');
}
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/**
* Where to redirect users when the intended url fails.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
}

View File

@ -0,0 +1,32 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class LoginController extends Controller
{
public function showLoginForm()
{
return view('login');
}
public function showChangePasswordForm()
{
return view('change-password');
}
public function showProfile()
{
return view('pages.my-profile');
}
public function storeUsername(Request $request)
{
session(['username' => $request->input('username')]);
return response()->json(['success' => true]);
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Models\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo = '/home';
}

View File

@ -0,0 +1,41 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/**
* Where to redirect users after verification.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('signed')->only('verify');
$this->middleware('throttle:6,1')->only('verify', 'resend');
}
}

View File

@ -0,0 +1,202 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;
class AuthController extends Controller
{
protected $apiBaseUrl = 'http://192.168.100.6:8081/api';
/**
* Show the login form
*/
public function showLoginForm()
{
return view('login');
}
/**
* Handle login form submission by calling the API
*/
public function login(Request $request)
{
$request->validate([
'username' => 'required|string',
'password' => 'required|string',
]);
try {
$response = Http::post(config('services.backend_api.url') . '/api/cms/login_password', [
'username' => $request->username,
'password' => $request->password,
]);
$json = $response->json();
Log::info('Login API Response: ', $json);
if ($response->successful()) {
if ($json['code'] == 200) {
$userData = [
'admin' => $json['data']['admin'] ?? null,
'access_token' => $json['data']['token'] ?? null,
'admin_uuid' => $json['data']['admin']['uuid'] ?? null,
];
Session::put('user', $userData);
Session::save();
Log::info('Session data after login: ', Session::get('user'));
// Redirect to my-profile if access_token is present
if (isset($userData['access_token']) && !empty($userData['access_token'])) {
Log::info('Access token present, redirecting to my-profile from login');
return redirect()->route('my-profile');
}
$isPasswordChanged = $json['data']['admin']['is_passwordChanged'] ?? 0;
Log::info('Login: is_passwordChanged from API = ' . $isPasswordChanged);
if ($isPasswordChanged == 1) {
Log::info('Redirecting to my-profile from login');
return redirect()->route('my-profile');
} else {
Log::info('Redirecting to change-password from login');
return redirect()->route('change-password')->with('info', 'You must change your password before accessing your profile.');
}
} else {
return back()->withErrors(['username' => $json['message'] ?? 'Login failed.']);
}
} else {
return back()->withErrors(['username' => $json['message'] ?? 'Login request failed.']);
}
} catch (\Exception $e) {
Log::error('Login error: ' . $e->getMessage());
return back()->withErrors(['username' => 'An error occurred: ' . $e->getMessage()]);
}
}
/**
* Show the my-profile page
*/
public function showMyProfile()
{
$user = Session::get('user');
if (!$user || !isset($user['access_token'])) {
Log::info('No user session or access token, redirecting to login from my-profile');
return redirect()->route('login')->with('error', 'Please log in to view your profile.');
}
if (!isset($user['admin']) || !is_array($user['admin'])) {
Log::error('Invalid admin data in session: ', $user);
return redirect()->route('login')->with('error', 'Invalid user data. Please log in again.');
}
Log::info('Session data in my-profile: ', $user);
Log::info('Rendering my-profile page');
return view('pages.my-profile', compact('user'));
}
/**
* Show the change password form
*/
public function showChangePasswordForm()
{
if (!session()->has('user.admin_uuid')) {
Log::info('No admin_uuid in session, redirecting to login from change-password form');
return redirect()->route('login')->withErrors(['error' => 'Unauthorized access']);
}
Log::info('Rendering change-password form');
return view('change-password');
}
/**
* Handle change password form submission by calling the API
*/
public function changePassword(Request $request)
{
$request->validate([
'admin_uuid' => 'required|string',
'password' => 'required|string|min:8|confirmed',
]);
$url = "{$this->apiBaseUrl}/cms/login_changePassword";
$csrfToken = $request->session()->token();
try {
$response = Http::withHeaders([
'X-CSRF-TOKEN' => $csrfToken,
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . session('user.access_token'),
])->post($url, [
'admin_uuid' => $request->input('admin_uuid'),
'password' => $request->input('password'),
]);
$data = $response->json();
Log::info('Change Password API Response: ', $data);
if ($response->successful() && isset($data['code']) && $data['code'] === 200) {
$user = Session::get('user');
// Update access token from API response
if (isset($data['token'])) {
$user['access_token'] = $data['token'];
} elseif (isset($data['data']['access_token'])) {
$user['access_token'] = $data['data']['access_token'];
}
// Update admin data with the latest from API
if (isset($data['admin'])) {
$user['admin'] = $data['admin'];
}
Session::put('user', $user);
Session::save();
Log::info('Updated Session after password change: ', Session::get('user'));
Log::info('Redirecting to my-profile from changePassword');
// Immediately redirect to my-profile
return redirect()->route('my-profile')->with('success', $data['message'] ?? 'Password changed successfully');
}
Log::info('Change password failed, redirecting back');
return redirect()->back()->withErrors(['error' => $data['message'] ?? 'Failed to change password']);
} catch (\Exception $e) {
Log::error('Change Password Exception: ' . $e->getMessage());
return redirect()->back()->withErrors(['error' => 'Password change request failed: ' . $e->getMessage()]);
}
}
/**
* Handle logout by calling the API
*/
public function logout(Request $request)
{
$url = "{$this->apiBaseUrl}/logout_cms";
$csrfToken = $request->session()->token();
try {
Http::withHeaders([
'X-CSRF-TOKEN' => $csrfToken,
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . session('user.access_token'),
])->post($url);
session()->flush();
Log::info('Logged out, redirecting to login');
return redirect()->route('login')->with('success', 'Logged out successfully');
} catch (\Exception $e) {
Log::error('Logout Exception: ' . $e->getMessage());
session()->flush();
return redirect()->route('login')->with('success', 'Logged out successfully');
}
}
}

View File

@ -0,0 +1,164 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\CardMemberService;
use Illuminate\Http\Request;
class CardMemberController extends Controller
{
protected $cardMemberService;
public function __construct(CardMemberService $cardMemberService)
{
$this->cardMemberService = $cardMemberService;
}
public function index()
{
$response = $this->cardMemberService->getAllMembers();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.member-management.index', [
'members' => $response['data']
]);
}
public function create()
{
$cardTypes = $this->cardMemberService->getCardTypes();
return view('pages.member-management.create', [
'cardTypes' => $cardTypes['data'] ?? []
]);
}
public function store(Request $request)
{
$response = $this->cardMemberService->createMember($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('card-members.index')
->with('success', 'Card member created successfully');
}
public function edit($id)
{
$memberResponse = $this->cardMemberService->getMember($id);
$cardTypesResponse = $this->cardMemberService->getCardTypes();
if (!$memberResponse['success']) {
return back()->with('error', $memberResponse['message']);
}
return view('pages.member-management.edit', [
'member' => $memberResponse['data'],
'cardTypes' => $cardTypesResponse['data'] ?? []
]);
}
public function update(Request $request, $id)
{
$response = $this->cardMemberService->updateMember($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('card-members.index')
->with('success', 'Card member updated successfully');
}
public function destroy($id)
{
$response = $this->cardMemberService->deleteMember($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('card-members.index')
->with('success', 'Card member deleted successfully');
}
public function cardTypes()
{
$response = $this->cardMemberService->getCardTypes();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.add-card-types', [
'cardTypes' => $response['data']
]);
}
public function storeCardType(Request $request)
{
$response = $this->cardMemberService->createCardType($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('card-types.index')
->with('success', 'Card type created successfully');
}
public function updateCardType(Request $request, $id)
{
$response = $this->cardMemberService->updateCardType($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('card-types.index')
->with('success', 'Card type updated successfully');
}
public function deleteCardType($id)
{
$response = $this->cardMemberService->deleteCardType($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('card-types.index')
->with('success', 'Card type deleted successfully');
}
public function topUpHistory(Request $request)
{
$memberId = $request->query('member_id');
$response = $this->cardMemberService->getTopUpHistory($memberId);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.top-up', [
'history' => $response['data']
]);
}
public function processTopUp(Request $request)
{
$response = $this->cardMemberService->topUp($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('top-up.index')
->with('success', 'Top-up processed successfully');
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
class ChangePasswordController extends Controller
{
protected $apiBaseUrl;
public function __construct()
{
$this->apiBaseUrl = env('API_BASE_URL', 'http://your-backend-api-url');
}
public function showChangePasswordForm()
{
return view('change-password');
}
public function updatePassword(Request $request)
{
$request->validate([
'password' => 'required|min:8|confirmed',
]);
$adminId = Session::get('admin_id');
$apiToken = Session::get('api_token');
if (!$adminId || !$apiToken) {
return redirect()->route('login')->with('error', 'You must be logged in to change your password');
}
$response = Http::withToken($apiToken)
->get("{$this->apiBaseUrl}/api/admin/{$adminId}");
if ($response->failed()) {
return redirect()->back()->with('error', 'Unable to fetch admin data. Please try again later.');
}
$admin = $response->json();
if (!$admin) {
return redirect()->route('login')->with('error', 'Admin not found');
}
$updateResponse = Http::withToken($apiToken)
->put("{$this->apiBaseUrl}/api/admin/{$adminId}", [
'password' => bcrypt($request->password),
'is_passwordChanged' => 1,
]);
if ($updateResponse->failed()) {
return redirect()->back()->with('error', 'Failed to update password. Please try again.');
}
return redirect()->route('my-profile')->with('success', 'Password updated successfully');
}
// Method to fetch and display admin profile data
public function showProfile()
{
$adminId = Session::get('admin_id');
$apiToken = Session::get('api_token');
if (!$adminId || !$apiToken) {
return redirect()->route('login')->with('error', 'You must be logged in to view your profile');
}
$response = Http::withToken($apiToken)
->get("{$this->apiBaseUrl}/api/admin/{$adminId}");
if ($response->failed()) {
return redirect()->back()->with('error', 'Unable to fetch profile data. Please try again later.');
}
$admin = $response->json();
if (!$admin) {
return redirect()->route('login')->with('error', 'Admin not found');
}
return view('my-profile', ['admin' => $admin]);
}
}

View File

@ -0,0 +1,207 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\ContentService;
use Illuminate\Http\Request;
class ContentController extends Controller
{
protected $contentService;
public function __construct(ContentService $contentService)
{
$this->contentService = $contentService;
}
// Promotions
public function promotionsIndex()
{
$response = $this->contentService->getAllPromotions();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.promotions', [
'promotions' => $response['data']
]);
}
public function createPromotion()
{
return view('pages.add-promotions');
}
public function storePromotion(Request $request)
{
$response = $this->contentService->createPromotion($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('promotions.index')
->with('success', 'Promotion created successfully');
}
public function updatePromotion(Request $request, $id)
{
$response = $this->contentService->updatePromotion($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('promotions.index')
->with('success', 'Promotion updated successfully');
}
public function deletePromotion($id)
{
$response = $this->contentService->deletePromotion($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('promotions.index')
->with('success', 'Promotion deleted successfully');
}
// Notifications
public function notificationsIndex()
{
$response = $this->contentService->getAllNotifications();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.notification', [
'notifications' => $response['data']
]);
}
public function createNotification()
{
return view('pages.add-notification');
}
public function storeNotification(Request $request)
{
$response = $this->contentService->createNotification($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('notifications.index')
->with('success', 'Notification created successfully');
}
public function updateNotification(Request $request, $id)
{
$response = $this->contentService->updateNotification($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('notifications.index')
->with('success', 'Notification updated successfully');
}
public function deleteNotification($id)
{
$response = $this->contentService->deleteNotification($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('notifications.index')
->with('success', 'Notification deleted successfully');
}
// Photo Slider
public function slidesIndex()
{
$response = $this->contentService->getAllSlides();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.photo-slider', [
'slides' => $response['data']
]);
}
public function createSlide()
{
return view('pages.add-photo-slider');
}
public function storeSlide(Request $request)
{
$response = $this->contentService->createSlide($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('slides.index')
->with('success', 'Slide created successfully');
}
public function updateSlide(Request $request, $id)
{
$response = $this->contentService->updateSlide($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('slides.index')
->with('success', 'Slide updated successfully');
}
public function deleteSlide($id)
{
$response = $this->contentService->deleteSlide($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('slides.index')
->with('success', 'Slide deleted successfully');
}
// Terms and Privacy
public function termsAndPrivacy()
{
$response = $this->contentService->getTermsAndPrivacy();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.add-terms-and-privacy', [
'content' => $response['data']
]);
}
public function updateTermsAndPrivacy(Request $request)
{
$response = $this->contentService->updateTermsAndPrivacy($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('terms-and-privacy.index')
->with('success', 'Terms and Privacy updated successfully');
}
}

View File

@ -0,0 +1,12 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
}

View File

@ -0,0 +1,120 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\FuelPriceService;
use Illuminate\Http\Request;
class FuelPriceController extends Controller
{
protected $fuelPriceService;
public function __construct(FuelPriceService $fuelPriceService)
{
$this->fuelPriceService = $fuelPriceService;
}
public function onDemand()
{
$response = $this->fuelPriceService->getCurrentPrices();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.fuel-price-on-demand', [
'prices' => $response['data']
]);
}
public function updateOnDemand(Request $request)
{
$response = $this->fuelPriceService->updatePrices($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-price.on-demand')
->with('success', 'Fuel prices updated successfully');
}
public function schedule()
{
$response = $this->fuelPriceService->getScheduledUpdates();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.fuel-price-schedule', [
'schedules' => $response['data']
]);
}
public function storeSchedule(Request $request)
{
$response = $this->fuelPriceService->createSchedule($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-price.schedule')
->with('success', 'Price update scheduled successfully');
}
public function updateSchedule(Request $request, $id)
{
$response = $this->fuelPriceService->updateSchedule($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-price.schedule')
->with('success', 'Schedule updated successfully');
}
public function deleteSchedule($id)
{
$response = $this->fuelPriceService->deleteSchedule($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('fuel-price.schedule')
->with('success', 'Schedule deleted successfully');
}
public function logs()
{
$response = $this->fuelPriceService->getUpdateLogs();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.fuel-price-update-logs', [
'logs' => $response['data']
]);
}
public function importPrices(Request $request)
{
$response = $this->fuelPriceService->importPrices($request->file('csv_file'));
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-price.on-demand')
->with('success', 'Fuel prices imported successfully');
}
public function exportPrices()
{
return $this->fuelPriceService->exportPrices();
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function index()
{
return view('home');
}
}

View File

@ -0,0 +1,133 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\StationService;
use Illuminate\Http\Request;
class StationController extends Controller
{
protected $stationService;
public function __construct(StationService $stationService)
{
$this->stationService = $stationService;
}
public function index()
{
$response = $this->stationService->getAllStations();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.station-locator.index', [
'stations' => $response['data']
]);
}
public function create()
{
return view('pages.station-locator.create');
}
public function store(Request $request)
{
$response = $this->stationService->createStation($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('stations.index')
->with('success', 'Station created successfully');
}
public function edit($id)
{
$response = $this->stationService->getStation($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.station-locator.edit', [
'station' => $response['data']
]);
}
public function update(Request $request, $id)
{
$response = $this->stationService->updateStation($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('stations.index')
->with('success', 'Station updated successfully');
}
public function destroy($id)
{
$response = $this->stationService->deleteStation($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('stations.index')
->with('success', 'Station deleted successfully');
}
public function fuelPrices()
{
$response = $this->stationService->getFuelPrices();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.fuel-price-on-demand', [
'fuelPrices' => $response['data']
]);
}
public function updateFuelPrices(Request $request)
{
$response = $this->stationService->updateFuelPrices($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-prices.index')
->with('success', 'Fuel prices updated successfully');
}
public function fuelPriceSchedule()
{
$response = $this->stationService->getFuelPriceSchedule();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.fuel-price-schedule', [
'schedules' => $response['data']
]);
}
public function storeFuelPriceSchedule(Request $request)
{
$response = $this->stationService->createFuelPriceSchedule($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('fuel-prices.schedule')
->with('success', 'Fuel price schedule created successfully');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\SystemParameterService;
use Illuminate\Http\Request;
class SystemParameterController extends Controller
{
protected $systemParamService;
public function __construct(SystemParameterService $systemParamService)
{
$this->systemParamService = $systemParamService;
}
public function index()
{
$response = $this->systemParamService->getAllParameters();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.system-parameters', [
'parameters' => $response['data']
]);
}
public function store(Request $request)
{
$response = $this->systemParamService->createParameter($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('system-parameters.index')
->with('success', 'Parameter created successfully');
}
public function update(Request $request, $id)
{
$response = $this->systemParamService->updateParameter($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('system-parameters.index')
->with('success', 'Parameter updated successfully');
}
public function destroy($id)
{
$response = $this->systemParamService->deleteParameter($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('system-parameters.index')
->with('success', 'Parameter deleted successfully');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\TopUpSettingService;
use Illuminate\Http\Request;
class TopUpSettingController extends Controller
{
protected $topUpSettingService;
public function __construct(TopUpSettingService $topUpSettingService)
{
$this->topUpSettingService = $topUpSettingService;
}
public function index()
{
$response = $this->topUpSettingService->getAllSettings();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.top-up-settings', [
'settings' => $response['data']
]);
}
public function store(Request $request)
{
$response = $this->topUpSettingService->createSetting($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('top-up-settings.index')
->with('success', 'Setting created successfully');
}
public function update(Request $request, $id)
{
$response = $this->topUpSettingService->updateSetting($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('top-up-settings.index')
->with('success', 'Setting updated successfully');
}
public function destroy($id)
{
$response = $this->topUpSettingService->deleteSetting($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('top-up-settings.index')
->with('success', 'Setting deleted successfully');
}
}

View File

@ -0,0 +1,90 @@
<?php
namespace App\Http\Controllers;
use App\Services\Api\UserManagementService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;
class UserManagementController extends Controller
{
protected $userService;
protected $apiBaseUrl = 'http://192.168.100.6:8081/api'; // Same as in AuthController
public function __construct(UserManagementService $userService)
{
$this->userService = $userService;
}
/**
* Display the user management page with user data
*/
public function index()
{
$response = $this->userService->getAllUsers();
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.user-management.index', [
'users' => $response['data']
]);
}
public function create()
{
return view('pages.user-management.create');
}
public function store(Request $request)
{
$response = $this->userService->createUser($request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('user-management.index')
->with('success', 'User created successfully');
}
public function edit($id)
{
$response = $this->userService->getUser($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return view('pages.user-management.edit', [
'user' => $response['data']
]);
}
public function update(Request $request, $id)
{
$response = $this->userService->updateUser($id, $request->all());
if (!$response['success']) {
return back()->withInput()->with('error', $response['message']);
}
return redirect()->route('user-management.index')
->with('success', 'User updated successfully');
}
public function destroy($id)
{
$response = $this->userService->deleteUser($id);
if (!$response['success']) {
return back()->with('error', $response['message']);
}
return redirect()->route('user-management.index')
->with('success', 'User deleted successfully');
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserViewController extends Controller
{
//
}

48
app/Models/User.php Normal file
View File

@ -0,0 +1,48 @@
<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'name',
'email',
'password',
];
/**
* The attributes that should be hidden for serialization.
*
* @var list<string>
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\View;
use App\View\Composers\UserViewComposer;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}
/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Share authenticated user with the 'layouts.app' view
View::composer('layouts.app', UserViewComposer::class);
}
}

View File

@ -0,0 +1,92 @@
<?php
namespace App\Services\Api;
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\Response;
use Exception;
class ApiService
{
protected string $baseUrl;
public function __construct()
{
// Get the external API URL from environment variable
$this->baseUrl = env('EXTERNAL_API_URL', 'http://localhost:8000/api');
}
/**
* Make a GET request to the API
*/
public function fetch($endpoint, array $params = [])
{
try {
$response = Http::withHeaders($this->getHeaders())
->get($this->baseUrl . $endpoint, $params);
if ($response->successful()) {
return [
'success' => true,
'data' => $response->json()['data'] ?? $response->json(),
'message' => 'Data fetched successfully'
];
}
return [
'success' => false,
'message' => $response->json()['message'] ?? 'Failed to fetch data',
'errors' => $response->json()['errors'] ?? []
];
} catch (Exception $e) {
return [
'success' => false,
'message' => 'API service is unavailable',
'errors' => [$e->getMessage()]
];
}
}
/**
* Make a POST request to the API
*/
public function submit($endpoint, array $data = [])
{
try {
$response = Http::withHeaders($this->getHeaders())
->post($this->baseUrl . $endpoint, $data);
if ($response->successful()) {
return [
'success' => true,
'data' => $response->json()['data'] ?? $response->json(),
'message' => 'Data submitted successfully'
];
}
return [
'success' => false,
'message' => $response->json()['message'] ?? 'Failed to submit data',
'errors' => $response->json()['errors'] ?? []
];
} catch (Exception $e) {
return [
'success' => false,
'message' => 'API service is unavailable',
'errors' => [$e->getMessage()]
];
}
}
/**
* Get the headers for API requests
*/
protected function getHeaders(): array
{
return [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . session('api_token'),
];
}
}

View File

@ -0,0 +1,78 @@
<?php
namespace App\Services\Api;
use Illuminate\Support\Facades\Http;
use Exception;
class BaseApiService
{
protected string $baseUrl;
public function __construct()
{
$this->baseUrl = env('EXTERNAL_API_URL', 'http://localhost:8000/api');
}
protected function get($endpoint, array $params = [])
{
try {
$response = Http::withHeaders($this->getHeaders())
->get($this->baseUrl . $endpoint, $params);
return $this->handleResponse($response);
} catch (Exception $e) {
return $this->handleException($e);
}
}
protected function post($endpoint, array $data = [], $hasFile = false)
{
try {
$http = Http::withHeaders($this->getHeaders());
if ($hasFile) {
$http = $http->asMultipart();
}
$response = $http->post($this->baseUrl . $endpoint, $data);
return $this->handleResponse($response);
} catch (Exception $e) {
return $this->handleException($e);
}
}
protected function handleResponse($response)
{
if ($response->successful()) {
return [
'success' => true,
'data' => $response->json()['data'] ?? $response->json(),
'message' => 'Operation successful'
];
}
return [
'success' => false,
'message' => $response->json()['message'] ?? 'Operation failed',
'errors' => $response->json()['errors'] ?? []
];
}
protected function handleException(Exception $e)
{
return [
'success' => false,
'message' => 'API service is unavailable',
'errors' => [$e->getMessage()]
];
}
protected function getHeaders()
{
return [
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . session('api_token')
];
}
}

View File

@ -0,0 +1,61 @@
<?php
namespace App\Services\Api;
class CardMemberService extends BaseApiService
{
public function getAllMembers(array $params = [])
{
return $this->get('/card-members', $params);
}
public function getMember($id)
{
return $this->get("/card-members/{$id}");
}
public function createMember(array $data)
{
return $this->post('/card-members', $data);
}
public function updateMember($id, array $data)
{
return $this->post("/card-members/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteMember($id)
{
return $this->post("/card-members/{$id}", ['_method' => 'DELETE']);
}
public function getCardTypes()
{
return $this->get('/card-types');
}
public function createCardType(array $data)
{
return $this->post('/card-types', $data);
}
public function updateCardType($id, array $data)
{
return $this->post("/card-types/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteCardType($id)
{
return $this->post("/card-types/{$id}", ['_method' => 'DELETE']);
}
public function topUp(array $data)
{
return $this->post('/card-members/top-up', $data);
}
public function getTopUpHistory($memberId, array $params = [])
{
return $this->get("/card-members/{$memberId}/top-up-history", $params);
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace App\Services\Api;
class ContentService extends BaseApiService
{
// Promotions
public function getAllPromotions(array $params = [])
{
return $this->get('/promotions', $params);
}
public function createPromotion(array $data)
{
return $this->post('/promotions', $data, true); // true for image upload
}
public function updatePromotion($id, array $data)
{
return $this->post("/promotions/{$id}", array_merge($data, ['_method' => 'PUT']), true);
}
public function deletePromotion($id)
{
return $this->post("/promotions/{$id}", ['_method' => 'DELETE']);
}
// Notifications
public function getAllNotifications(array $params = [])
{
return $this->get('/notifications', $params);
}
public function createNotification(array $data)
{
return $this->post('/notifications', $data);
}
public function updateNotification($id, array $data)
{
return $this->post("/notifications/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteNotification($id)
{
return $this->post("/notifications/{$id}", ['_method' => 'DELETE']);
}
// Photo Slider
public function getAllSlides(array $params = [])
{
return $this->get('/photo-slider', $params);
}
public function createSlide(array $data)
{
return $this->post('/photo-slider', $data, true); // true for image upload
}
public function updateSlide($id, array $data)
{
return $this->post("/photo-slider/{$id}", array_merge($data, ['_method' => 'PUT']), true);
}
public function deleteSlide($id)
{
return $this->post("/photo-slider/{$id}", ['_method' => 'DELETE']);
}
// Terms and Privacy
public function getTermsAndPrivacy()
{
return $this->get('/terms-and-privacy');
}
public function updateTermsAndPrivacy(array $data)
{
return $this->post('/terms-and-privacy', $data);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Services\Api;
use Illuminate\Http\UploadedFile;
class FuelPriceService extends BaseApiService
{
public function getCurrentPrices(array $params = [])
{
return $this->get('/fuel-prices/current', $params);
}
public function updatePrices(array $data)
{
return $this->post('/fuel-prices/update', $data);
}
public function getScheduledUpdates(array $params = [])
{
return $this->get('/fuel-prices/schedule', $params);
}
public function createSchedule(array $data)
{
return $this->post('/fuel-prices/schedule', $data);
}
public function updateSchedule($id, array $data)
{
return $this->post("/fuel-prices/schedule/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteSchedule($id)
{
return $this->post("/fuel-prices/schedule/{$id}", ['_method' => 'DELETE']);
}
public function getUpdateLogs(array $params = [])
{
return $this->get('/fuel-prices/logs', $params);
}
public function importPrices(UploadedFile $file)
{
return $this->post('/fuel-prices/import', [
'file' => $file
], true);
}
public function exportPrices()
{
return $this->get('/fuel-prices/export');
}
}

View File

@ -0,0 +1,51 @@
<?php
namespace App\Services\Api;
class StationService extends BaseApiService
{
public function getAllStations(array $params = [])
{
return $this->get('/stations', $params);
}
public function getStation($id)
{
return $this->get("/stations/{$id}");
}
public function createStation(array $data)
{
return $this->post('/stations', $data, true); // true for file upload support
}
public function updateStation($id, array $data)
{
return $this->post("/stations/{$id}", array_merge($data, ['_method' => 'PUT']), true);
}
public function deleteStation($id)
{
return $this->post("/stations/{$id}", ['_method' => 'DELETE']);
}
public function getFuelPrices(array $params = [])
{
return $this->get('/stations/fuel-prices', $params);
}
public function updateFuelPrices(array $data)
{
return $this->post('/stations/fuel-prices', $data);
}
public function getFuelPriceSchedule(array $params = [])
{
return $this->get('/stations/fuel-prices/schedule', $params);
}
public function createFuelPriceSchedule(array $data)
{
return $this->post('/stations/fuel-prices/schedule', $data);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Services\Api;
class SystemParameterService extends BaseApiService
{
public function getAllParameters(array $params = [])
{
return $this->get('/system-parameters', $params);
}
public function getParameter($id)
{
return $this->get("/system-parameters/{$id}");
}
public function createParameter(array $data)
{
return $this->post('/system-parameters', $data);
}
public function updateParameter($id, array $data)
{
return $this->post("/system-parameters/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteParameter($id)
{
return $this->post("/system-parameters/{$id}", ['_method' => 'DELETE']);
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace App\Services\Api;
class TopUpSettingService extends BaseApiService
{
public function getAllSettings(array $params = [])
{
return $this->get('/top-up-settings', $params);
}
public function getSetting($id)
{
return $this->get("/top-up-settings/{$id}");
}
public function createSetting(array $data)
{
return $this->post('/top-up-settings', $data);
}
public function updateSetting($id, array $data)
{
return $this->post("/top-up-settings/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteSetting($id)
{
return $this->post("/top-up-settings/{$id}", ['_method' => 'DELETE']);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Services\Api;
class UserManagementService extends BaseApiService
{
public function getAllUsers(array $params = [])
{
return $this->get('/users', $params);
}
public function getUser($id)
{
return $this->get("/users/{$id}");
}
public function createUser(array $data)
{
return $this->post('/users', $data);
}
public function updateUser($id, array $data)
{
return $this->post("/users/{$id}", array_merge($data, ['_method' => 'PUT']));
}
public function deleteUser($id)
{
return $this->post("/users/{$id}", ['_method' => 'DELETE']);
}
public function changePassword(array $data)
{
return $this->post('/users/change-password', $data);
}
}

110
app/Services/ApiService.php Normal file
View File

@ -0,0 +1,110 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Log;
class ApiService
{
protected $baseUrl;
public function __construct()
{
$this->baseUrl = rtrim(env('API_URL', '/'));
}
public function fetchData($url, $token = null)
{
try {
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . ($token ?: Session::get('token', '')),
])->get($this->baseUrl . $url);
if ($response->successful()) {
return $response->json();
} else {
$this->handleError($response);
return null;
}
} catch (\Exception $e) {
Log::error('API Fetch Error: ' . $e->getMessage());
Session::flash('error', 'Failed to fetch data: ' . $e->getMessage());
return null;
}
}
public function logout($token = null)
{
try {
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . ($token ?: Session::get('token', '')),
])->get($this->baseUrl . '/logout');
if ($response->successful()) {
Session::forget('token');
Session::flash('success', 'Logged out successfully.');
return true;
} else {
$this->handleError($response);
return false;
}
} catch (\Exception $e) {
Log::error('Logout Error: ' . $e->getMessage());
Session::flash('error', 'Logout failed: ' . $e->getMessage());
return false;
}
}
public function handleError($response)
{
$status = $response->status();
if ($status === 401) {
Session::forget('token');
throw new \Exception('Session expired. Please login again.');
} elseif ($status === 404) {
throw new \Exception('API resource not found.');
} else {
throw new \Exception('API error: ' . ($response->body() ?: 'Unknown error'));
}
}
// public function get($url, $params = [])
// {
// $token = $this->cookieService->getCookie()['token'] ?? null;
// $this->defaultHeaders['Authorization'] = 'Bearer ' . $token;
// return $this->makeRequest('get', $url, $params);
// }
// public function post($url, $params = [])
// {
// return $this->makeRequest('post', $url, $params);
// }
public function get(string $endpoint, array $query = [])
{
return Http::get("{$this->baseUrl}/{$endpoint}", $data);
}
public function post(string $endpoint, array $data = [])
{
return Http::post("{$this->baseUrl}/{$endpoint}", $data);
}
public function put($url, $params = [])
{
return $this->makeRequest('put', $url, $params);
}
public function delete($url, $params = [])
{
return $this->makeRequest('delete', $url, ['params' => $params]);
}
public function postMultipart($url, $data)
{
return $this->makeRequest('postMultipart', $url, $data);
}
}

View File

@ -0,0 +1,89 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Log;
use App\Livewire\ErrorHandler;
class BaseApiService
{
protected $baseUrl;
protected $defaultHeaders = [];
public function __construct(string $baseUrl)
{
$this->baseUrl = $baseUrl;
}
protected function makeRequest($method, $url, $params = [], $headers = [])
{
try {
$fullHeaders = array_merge($this->defaultHeaders, $headers, [
'Authorization' => 'Bearer ' . Session::get('token', ''),
]);
$response = Http::withHeaders($fullHeaders)->{$method}($this->baseUrl . $url, $params);
if ($response->successful()) {
return $response->json();
} else {
$this->handleError($response);
return null;
}
} catch (\Exception $e) {
Log::error('API Request Error: ' . $e->getMessage());
Session::flash('error', 'API request failed: ' . $e->getMessage());
return null;
}
}
protected function handleError($response)
{
$status = $response->status();
if ($status === 401) {
Session::forget('token');
throw new \Exception('Session expired. Please login again.');
} elseif ($status === 422) {
throw new \Exception('Validation error: ' . ($response->body() ?: 'Unknown validation error'));
} elseif ($status === 404) {
throw new \Exception('API resource not found.');
} else {
throw new \Exception('API error: ' . ($response->body() ?: 'Unknown error'));
}
}
public function postMultipart($url, $data)
{
try {
$headers = array_merge($this->defaultHeaders, [
'Authorization' => 'Bearer ' . Session::get('token', ''),
'Content-Type' => 'multipart/form-data',
]);
$response = Http::withHeaders($headers)->asMultipart();
foreach ($data as $key => $value) {
if ($value instanceof \Illuminate\Http\UploadedFile) {
$response = $response->attach($key, $value->get(), $value->getClientOriginalName());
} else {
$response = $response->attach($key, $value);
}
}
$response = $response->post($this->baseUrl . $url);
if ($response->successful()) {
return $response->json();
} else {
$this->handleError($response);
return null;
}
} catch (\Exception $e) {
Log::error('Multipart API Request Error: ' . $e->getMessage());
throw $e;
}
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Log;
class CookieService
{
const COOKIE_NAME = 'FRONT_END_REST';
const PUBLIC_KEY = 'PUBLIC_00001';
const TIME_OUT_HOURS = 1; // 60 minutes
public function setCookie(array $params, string $name = self::COOKIE_NAME): bool
{
try {
if (!is_array($params)) {
throw new \TypeError('setCookie params should be an array.', 'CookieService.php', 20);
}
$expiration = now()->addHours(self::TIME_OUT_HOURS);
$encryptedValue = Crypt::encryptString(json_encode($params));
Cookie::queue($name, $encryptedValue, $expiration->diffInMinutes(), '/', null, false, true);
return true;
} catch (\Exception $e) {
Log::error('Cookie Set Error: ' . $e->getMessage());
return false;
}
}
public function getCookie(string $name = self::COOKIE_NAME)
{
$cookie = Cookie::get($name);
if (!$cookie) {
return null;
}
try {
return json_decode(Crypt::decryptString($cookie), true);
} catch (\Exception $e) {
Log::error('Cookie Get Error: ' . $e->getMessage());
return null;
}
}
public function removeCookie(string $name = self::COOKIE_NAME): bool
{
Cookie::queue(Cookie::forget($name));
return true;
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Services;
use Illuminate\Support\Facades\Session;
class EncryptionService
{
const ALGORITHM = 'aes-256-ctr';
private $password;
public function __construct()
{
$this->password = $this->getPasswordFromCookie();
}
private function getPasswordFromCookie()
{
$cookieService = app(CookieService::class);
$cookie = $cookieService->getCookie(process.env.REACT_APP_TOKEN ?? 'token');
return $cookie['token'] ?? 'default_password'; // Fallback if token not found
}
public function encrypt(string $text): string
{
$iv = random_bytes(16); // Initialization vector
$encrypted = openssl_encrypt($text, self::ALGORITHM, $this->password, 0, $iv);
return base64_encode($iv . $encrypted); // Combine IV and encrypted data
}
public function decrypt(string $text): string|bool
{
$data = base64_decode($text);
$iv = substr($data, 0, 16);
$encrypted = substr($data, 16);
$decrypted = openssl_decrypt($encrypted, self::ALGORITHM, $this->password, 0, $iv);
if ($decrypted === false) {
return false;
}
// Check if the result is hexadecimal (simulating your JS check)
if (preg_match('/^[0-9a-fA-F]+$/', $decrypted)) {
return $decrypted;
}
return false;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace App\Services;
class NotificationApiService extends BaseApiService
{
public function __construct()
{
parent::__construct(config('app.notif_api_base_url'));
}
public function getNotification($url, $params = [])
{
return $this->makeRequest('get', $url, $params);
}
public function postNotification($url, $params = [])
{
return $this->makeRequest('post', $url, $params);
}
}

View File

@ -0,0 +1,56 @@
<?php
namespace App\Services;
class StationApiService extends BaseApiService
{
public function __construct()
{
parent::__construct(config('app.station_api_base_url'));
$this->defaultHeaders = array_merge($this->defaultHeaders, [
'X-Requested-With' => 'station-locator-api',
]);
}
public function getBranch($url, $params = [])
{
return $this->makeRequest('get', $url, $params);
}
public function postBranch($url, $params = [])
{
return $this->makeRequest('post', $url, $params);
}
public function putBranch($url, $params = [])
{
return $this->makeRequest('put', $url, $params);
}
public function deleteBranch($url, $params = [])
{
return $this->makeRequest('delete', $url, ['params' => $params]);
}
public function postFuel($url, $params = [])
{
return $this->makeRequest('post', $url, $params);
}
public function putFuel($url, $params = [])
{
return $this->makeRequest('put', $url, $params);
}
public function getFuels($url, $params = [])
{
return $this->makeRequest('get', $url, $params);
}
public function getCsv($url, $params = [])
{
return Http::withHeaders(array_merge($this->defaultHeaders, [
'Authorization' => 'Bearer ' . Session::get('token', ''),
]))->get($this->baseUrl . $url, $params)->body(); // Return raw text for CSV
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\View\Composers;
use Illuminate\View\View;
use Illuminate\Support\Facades\Session;
class UserViewComposer
{
public function compose(View $view)
{
// Retrieve the user data from the session, default to null if not set
$user = Session::get('user', null);
// Share the user data with the view
$view->with('user', $user);
}
}

15
artisan Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/env php
<?php
use Symfony\Component\Console\Input\ArgvInput;
define('LARAVEL_START', microtime(true));
// Register the Composer autoloader...
require __DIR__.'/vendor/autoload.php';
// Bootstrap Laravel and handle the command...
$status = (require_once __DIR__.'/bootstrap/app.php')
->handleCommand(new ArgvInput);
exit($status);

18
bootstrap/app.php Executable file
View File

@ -0,0 +1,18 @@
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

2
bootstrap/cache/.gitignore vendored Executable file
View File

@ -0,0 +1,2 @@
*
!.gitignore

5
bootstrap/providers.php Executable file
View File

@ -0,0 +1,5 @@
<?php
return [
App\Providers\AppServiceProvider::class,
];

74
composer.json Normal file
View File

@ -0,0 +1,74 @@
{
"$schema": "https://getcomposer.org/schema.json",
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"guzzlehttp/guzzle": "^7.9",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"laravel/ui": "^4.6",
"livewire/livewire": "^3.6"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.1",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^11.0.1"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi",
"@php -r \"file_exists('database/database.sqlite') || touch('database/database.sqlite');\"",
"@php artisan migrate --graceful --ansi"
],
"dev": [
"Composer\\Config::disableProcessTimeout",
"npx concurrently -c \"#93c5fd,#c4b5fd,#fb7185,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"php artisan pail --timeout=0\" \"npm run dev\" --names=server,queue,logs,vite"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}

8216
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

127
config/app.php Normal file
View File

@ -0,0 +1,127 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application, which will be used when the
| framework needs to place the application's name in a notification or
| other UI elements where an application name needs to be displayed.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| the application so that it's available within Artisan commands.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'api_base_url' => env('API_BASE_URL', 'http://192.168.100.6:8081'),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. The timezone
| is set to "UTC" by default as it is suitable for most use cases.
|
*/
'timezone' => env('APP_TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by Laravel's translation / localization methods. This option can be
| set to any locale for which you plan to have translation strings.
|
*/
'locale' => env('APP_LOCALE', 'en'),
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is utilized by Laravel's encryption services and should be set
| to a random, 32 character string to ensure that all encrypted values
| are secure. You should do this prior to deploying the application.
|
*/
'cipher' => 'AES-256-CBC',
'key' => env('APP_KEY'),
'previous_keys' => [
...array_filter(
explode(',', env('APP_PREVIOUS_KEYS', ''))
),
],
/*
|--------------------------------------------------------------------------
| Maintenance Mode Driver
|--------------------------------------------------------------------------
|
| These configuration options determine the driver used to determine and
| manage Laravel's "maintenance mode" status. The "cache" driver will
| allow maintenance mode to be controlled across multiple machines.
|
| Supported drivers: "file", "cache"
|
*/
'maintenance' => [
'driver' => env('APP_MAINTENANCE_DRIVER', 'file'),
'store' => env('APP_MAINTENANCE_STORE', 'database'),
],
];

115
config/auth.php Normal file
View File

@ -0,0 +1,115 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option defines the default authentication "guard" and password
| reset "broker" for your application. You may change these values
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => env('AUTH_GUARD', 'web'),
'passwords' => env('AUTH_PASSWORD_BROKER', 'users'),
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| which utilizes session storage plus the Eloquent user provider.
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| Supported: "session"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication guards have a user provider, which defines how the
| users are actually retrieved out of your database or other storage
| system used by the application. Typically, Eloquent is utilized.
|
| If you have multiple user tables or models you may configure multiple
| providers to represent the model / table. These providers may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| These configuration options specify the behavior of Laravel's password
| reset functionality, including the table utilized for token storage
| and the user provider that is invoked to actually retrieve users.
|
| The expiry time is the number of minutes that each reset token will be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The throttle setting is the number of seconds a user must wait before
| generating more password reset tokens. This prevents the user from
| quickly generating a very large amount of password reset tokens.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'),
'expire' => 60,
'throttle' => 60,
],
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| window expires and users are asked to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800),
];

108
config/cache.php Normal file
View File

@ -0,0 +1,108 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache store that will be used by the
| framework. This connection is utilized if another isn't explicitly
| specified when running a cache operation inside the application.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "array", "database", "file", "memcached",
| "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
'array' => [
'driver' => 'array',
'serialize' => false,
],
'database' => [
'driver' => 'database',
'connection' => env('DB_CACHE_CONNECTION'),
'table' => env('DB_CACHE_TABLE', 'cache'),
'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'),
'lock_table' => env('DB_CACHE_LOCK_TABLE'),
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
'lock_path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_CACHE_CONNECTION', 'cache'),
'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'),
],
'dynamodb' => [
'driver' => 'dynamodb',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
'endpoint' => env('DYNAMODB_ENDPOINT'),
],
'octane' => [
'driver' => 'octane',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing the APC, database, memcached, Redis, and DynamoDB cache
| stores, there might be other applications using the same cache. For
| that reason, you may prefix every cache key to avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
];

173
config/database.php Normal file
View File

@ -0,0 +1,173 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for database operations. This is
| the connection which will be utilized unless another connection
| is explicitly specified when you execute a query / statement.
|
*/
'default' => env('DB_CONNECTION', 'sqlite'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Below are all of the database connections defined for your application.
| An example configuration is provided for each database system which
| is supported by Laravel. You're free to add / remove connections.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'url' => env('DB_URL'),
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
'busy_timeout' => null,
'journal_mode' => null,
'synchronous' => null,
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'db_mysql'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'unioil-database'),
'username' => env('DB_USERNAME', 'rootuser'),
'password' => env('DB_PASSWORD', 'password'),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mariadb' => [
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run on the database.
|
*/
'migrations' => [
'table' => 'migrations',
'update_date_on_publish' => true,
],
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as Memcached. You may define your connection settings here.
|
*/
'redis' => [
'client' => env('REDIS_CLIENT', 'phpredis'),
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
],
'default' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_DB', '0'),
],
'cache' => [
'url' => env('REDIS_URL'),
'host' => env('REDIS_HOST', '127.0.0.1'),
'username' => env('REDIS_USERNAME'),
'password' => env('REDIS_PASSWORD'),
'port' => env('REDIS_PORT', '6379'),
'database' => env('REDIS_CACHE_DB', '1'),
],
],
];

80
config/filesystems.php Normal file
View File

@ -0,0 +1,80 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application for file storage.
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Below you may configure as many filesystem disks as necessary, and you
| may even configure multiple disks for the same driver. Examples for
| most supported storage drivers are configured here for reference.
|
| Supported drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
'report' => false,
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
'throw' => false,
'report' => false,
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
'report' => false,
],
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [
public_path('storage') => storage_path('app/public'),
],
];

160
config/livewire.php Normal file
View File

@ -0,0 +1,160 @@
<?php
return [
/*
|---------------------------------------------------------------------------
| Class Namespace
|---------------------------------------------------------------------------
|
| This value sets the root class namespace for Livewire component classes in
| your application. This value will change where component auto-discovery
| finds components. It's also referenced by the file creation commands.
|
*/
'class_namespace' => 'App\\Livewire',
/*
|---------------------------------------------------------------------------
| View Path
|---------------------------------------------------------------------------
|
| This value is used to specify where Livewire component Blade templates are
| stored when running file creation commands like `artisan make:livewire`.
| It is also used if you choose to omit a component's render() method.
|
*/
'view_path' => resource_path('views/livewire'),
/*
|---------------------------------------------------------------------------
| Layout
|---------------------------------------------------------------------------
| The view that will be used as the layout when rendering a single component
| as an entire page via `Route::get('/post/create', CreatePost::class);`.
| In this case, the view returned by CreatePost will render into $slot.
|
*/
'layout' => 'components.layouts.app',
/*
|---------------------------------------------------------------------------
| Lazy Loading Placeholder
|---------------------------------------------------------------------------
| Livewire allows you to lazy load components that would otherwise slow down
| the initial page load. Every component can have a custom placeholder or
| you can define the default placeholder view for all components below.
|
*/
'lazy_placeholder' => null,
/*
|---------------------------------------------------------------------------
| Temporary File Uploads
|---------------------------------------------------------------------------
|
| Livewire handles file uploads by storing uploads in a temporary directory
| before the file is stored permanently. All file uploads are directed to
| a global endpoint for temporary storage. You may configure this below:
|
*/
'temporary_file_upload' => [
'disk' => null, // Example: 'local', 's3' | Default: 'default'
'rules' => null, // Example: ['file', 'mimes:png,jpg'] | Default: ['required', 'file', 'max:12288'] (12MB)
'directory' => null, // Example: 'tmp' | Default: 'livewire-tmp'
'middleware' => null, // Example: 'throttle:5,1' | Default: 'throttle:60,1'
'preview_mimes' => [ // Supported file types for temporary pre-signed file URLs...
'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
'mov', 'avi', 'wmv', 'mp3', 'm4a',
'jpg', 'jpeg', 'mpga', 'webp', 'wma',
],
'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
],
/*
|---------------------------------------------------------------------------
| Render On Redirect
|---------------------------------------------------------------------------
|
| This value determines if Livewire will run a component's `render()` method
| after a redirect has been triggered using something like `redirect(...)`
| Setting this to true will render the view once more before redirecting
|
*/
'render_on_redirect' => false,
/*
|---------------------------------------------------------------------------
| Eloquent Model Binding
|---------------------------------------------------------------------------
|
| Previous versions of Livewire supported binding directly to eloquent model
| properties using wire:model by default. However, this behavior has been
| deemed too "magical" and has therefore been put under a feature flag.
|
*/
'legacy_model_binding' => false,
/*
|---------------------------------------------------------------------------
| Auto-inject Frontend Assets
|---------------------------------------------------------------------------
|
| By default, Livewire automatically injects its JavaScript and CSS into the
| <head> and <body> of pages containing Livewire components. By disabling
| this behavior, you need to use @livewireStyles and @livewireScripts.
|
*/
'inject_assets' => true,
/*
|---------------------------------------------------------------------------
| Navigate (SPA mode)
|---------------------------------------------------------------------------
|
| By adding `wire:navigate` to links in your Livewire application, Livewire
| will prevent the default link handling and instead request those pages
| via AJAX, creating an SPA-like effect. Configure this behavior here.
|
*/
'navigate' => [
'show_progress_bar' => true,
'progress_bar_color' => '#2299dd',
],
/*
|---------------------------------------------------------------------------
| HTML Morph Markers
|---------------------------------------------------------------------------
|
| Livewire intelligently "morphs" existing HTML into the newly rendered HTML
| after each update. To make this process more reliable, Livewire injects
| "markers" into the rendered Blade surrounding @if, @class & @foreach.
|
*/
'inject_morph_markers' => true,
/*
|---------------------------------------------------------------------------
| Pagination Theme
|---------------------------------------------------------------------------
|
| When enabling Livewire's pagination feature by using the `WithPagination`
| trait, Livewire will use Tailwind templates to render pagination views
| on the page. If you want Bootstrap CSS, you can specify: "bootstrap"
|
*/
'pagination_theme' => 'tailwind',
];

132
config/logging.php Normal file
View File

@ -0,0 +1,132 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use Monolog\Processor\PsrLogMessageProcessor;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that is utilized to write
| messages to your logs. The value provided here should match one of
| the channels present in the list of "channels" configured below.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => [
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
'trace' => env('LOG_DEPRECATIONS_TRACE', false),
],
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Laravel
| utilizes the Monolog PHP logging library, which includes a variety
| of powerful log handlers and formatters that you're free to use.
|
| Available drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog", "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => explode(',', env('LOG_STACK', 'single')),
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => env('LOG_DAILY_DAYS', 14),
'replace_placeholders' => true,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true,
],
'papertrail' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
],
'processors' => [PsrLogMessageProcessor::class],
],
'stderr' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
'processors' => [PsrLogMessageProcessor::class],
],
'syslog' => [
'driver' => 'syslog',
'level' => env('LOG_LEVEL', 'debug'),
'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER),
'replace_placeholders' => true,
],
'errorlog' => [
'driver' => 'errorlog',
'level' => env('LOG_LEVEL', 'debug'),
'replace_placeholders' => true,
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/laravel.log'),
],
],
];

116
config/mail.php Normal file
View File

@ -0,0 +1,116 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send all email
| messages unless another mailer is explicitly specified when sending
| the message. All additional mailers can be configured within the
| "mailers" array. Examples of each type of mailer are provided.
|
*/
'default' => env('MAIL_MAILER', 'log'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers that can be used
| when delivering an email. You may specify which one you're using for
| your mailers below. You may also add additional mailers if needed.
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
| "postmark", "resend", "log", "array",
| "failover", "roundrobin"
|
*/
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'scheme' => env('MAIL_SCHEME'),
'url' => env('MAIL_URL'),
'host' => env('MAIL_HOST', '127.0.0.1'),
'port' => env('MAIL_PORT', 2525),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'), PHP_URL_HOST)),
],
'ses' => [
'transport' => 'ses',
],
'postmark' => [
'transport' => 'postmark',
// 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'),
// 'client' => [
// 'timeout' => 5,
// ],
],
'resend' => [
'transport' => 'resend',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
'roundrobin' => [
'transport' => 'roundrobin',
'mailers' => [
'ses',
'postmark',
],
],
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all emails sent by your application to be sent from
| the same address. Here you may specify a name and address that is
| used globally for all emails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
];

112
config/queue.php Normal file
View File

@ -0,0 +1,112 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue supports a variety of backends via a single, unified
| API, giving you convenient access to each backend using identical
| syntax for each. The default queue connection is defined below.
|
*/
'default' => env('QUEUE_CONNECTION', 'database'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection options for every queue backend
| used by your application. An example configuration is provided for
| each backend supported by Laravel. You're also free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'connection' => env('DB_QUEUE_CONNECTION'),
'table' => env('DB_QUEUE_TABLE', 'jobs'),
'queue' => env('DB_QUEUE', 'default'),
'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90),
'after_commit' => false,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'),
'queue' => env('BEANSTALKD_QUEUE', 'default'),
'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90),
'block_for' => 0,
'after_commit' => false,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'default'),
'suffix' => env('SQS_SUFFIX'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'after_commit' => false,
],
'redis' => [
'driver' => 'redis',
'connection' => env('REDIS_QUEUE_CONNECTION', 'default'),
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90),
'block_for' => null,
'after_commit' => false,
],
],
/*
|--------------------------------------------------------------------------
| Job Batching
|--------------------------------------------------------------------------
|
| The following options configure the database and table that store job
| batching information. These options can be updated to any database
| connection and table which has been defined by your application.
|
*/
'batching' => [
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'job_batches',
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control how and where failed jobs are stored. Laravel ships with
| support for storing failed jobs in a simple file or in a database.
|
| Supported drivers: "database-uuids", "dynamodb", "file", "null"
|
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'sqlite'),
'table' => 'failed_jobs',
],
];

43
config/services.php Normal file
View File

@ -0,0 +1,43 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'token' => env('POSTMARK_TOKEN'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'resend' => [
'key' => env('RESEND_KEY'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
],
'backend_api' => [
'url' => 'http://192.168.100.6:8081', // Use the backend container name and internal port
],
];

217
config/session.php Normal file
View File

@ -0,0 +1,217 @@
<?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option determines the default session driver that is utilized for
| incoming requests. Laravel supports a variety of storage options to
| persist session data. Database storage is a great default choice.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "dynamodb", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'database'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to expire immediately when the browser is closed then you may
| indicate that via the expire_on_close configuration option.
|
*/
'lifetime' => (int) env('SESSION_LIFETIME', 120),
'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false),
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it's stored. All encryption is performed
| automatically by Laravel and you may use the session like normal.
|
*/
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When utilizing the "file" session driver, the session files are placed
| on disk. The default storage location is defined here; however, you
| are free to provide another location where they should be stored.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION'),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table to
| be used to store sessions. Of course, a sensible default is defined
| for you; however, you're welcome to change this to another table.
|
*/
'table' => env('SESSION_TABLE', 'sessions'),
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using one of the framework's cache driven session backends, you may
| define the cache store which should be used to store the session data
| between requests. This must match one of your defined cache stores.
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
*/
'store' => env('SESSION_STORE'),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the session cookie that is created by
| the framework. Typically, you should not need to change this value
| since doing so does not grant a meaningful security improvement.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application, but you're free to change this when necessary.
|
*/
'path' => env('SESSION_PATH', '/'),
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| This value determines the domain and subdomains the session cookie is
| available to. By default, the cookie will be available to the root
| domain and all subdomains. Typically, this shouldn't be changed.
|
*/
'domain' => env('SESSION_DOMAIN'),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you when it can't be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE'),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. It's unlikely you should disable this option.
|
*/
'http_only' => env('SESSION_HTTP_ONLY', true),
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| will set this value to "lax" to permit secure cross-site requests.
|
| See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value
|
| Supported: "lax", "strict", "none", null
|
*/
'same_site' => env('SESSION_SAME_SITE', 'lax'),
/*
|--------------------------------------------------------------------------
| Partitioned Cookies
|--------------------------------------------------------------------------
|
| Setting this value to true will tie the cookie to the top-level site for
| a cross-site context. Partitioned cookies are accepted by the browser
| when flagged "secure" and the Same-Site attribute is set to "none".
|
*/
'partitioned' => env('SESSION_PARTITIONED_COOKIE', false),
];

1
database/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.sqlite*

View File

@ -0,0 +1,44 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Seeders;
use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// User::factory(10)->create();
User::factory()->create([
'name' => 'Test User',
'email' => 'test@example.com',
]);
}
}

65
docker-compose.yml Normal file
View File

@ -0,0 +1,65 @@
version: '3.8'
services:
app:
build:
context: ./docker/php
dockerfile: Dockerfile
container_name: frontend-app
restart: always
working_dir: /var/www
volumes:
- .:/var/www
command: >
/bin/sh -c 'mkdir -p /var/www/storage /var/www/bootstrap/cache &&
chown -R www-data:www-data /var/www/storage /var/www/bootstrap/cache &&
chmod -R 775 /var/www/storage /var/www/bootstrap/cache &&
composer install --no-dev --optimize-autoloader &&
php-fpm'
healthcheck:
test: [ "CMD", "sh", "-c", "netstat -an | grep 9000 > /dev/null || exit 1" ]
interval: 30s
timeout: 10s
retries: 10
networks:
- frontend-network
- unioil-mobile-api_backend-network
environment:
- DB_HOST=db_mysql
- DB_PORT=3306
- DB_DATABASE=unioil-database
- DB_USERNAME=rootuser
- DB_PASSWORD=password
- MYSQL_ROOT_PASSWORD=newpassword
- CACHE_DRIVER=file
- API_URL=http://nginx:8081
web-frontend:
image: nginx:1.26.3-alpine
container_name: web-frontend
restart: always
ports:
- "8000:80"
expose:
- "80"
volumes:
- .:/var/www
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
app:
condition: service_healthy
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost" ]
interval: 30s
timeout: 10s
retries: 5
networks:
- frontend-network
- unioil-mobile-api_backend-network
networks:
frontend-network:
driver: bridge
unioil-mobile-api_backend-network:
external: true

24
docker/nginx/default.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
server_name localhost;
root /var/www/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass frontend-app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
}

33
docker/php/Dockerfile Normal file
View File

@ -0,0 +1,33 @@
FROM php:8.3-fpm
# Install system dependencies
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
zip \
unzip \
git \
curl \
libzip-dev \
net-tools \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql zip
# Install Composer
COPY --from=composer:2.7 /usr/bin/composer /usr/bin/composer
# Set working directory
WORKDIR /var/www
# Copy application code
COPY . /var/www
# Set permissions
RUN chown -R www-data:www-data /var/www \
&& chmod -R 755 /var/www
# Expose port
EXPOSE 9000
CMD ["php-fpm"]

28
docker/php/entrypoint.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
# Exit script on any error
set -e
# Ensure we're in the right directory
cd /var/www/html
# Install PHP dependencies
composer install --no-dev --optimize-autoloader
# Install Node.js dependencies if node_modules not present
if [ ! -d "node_modules" ]; then
npm install
fi
# Build frontend assets
npm run build
# Set correct permissions for storage and cache
chown -R www-data:www-data storage bootstrap/cache
chmod -R 775 storage bootstrap/
# Run database migrations
php artisan migrate --force
# Start PHP-FPM
php-fpm

17
index.html Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Frontend</title>
<script type="module" src="/resources/js/app.js"></script>
</head>
<body>
<div id="app">
<h1>Loading...</h1>
</div>
</body>
</html>

3823
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

31
package.json Normal file
View File

@ -0,0 +1,31 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"@popperjs/core": "^2.11.8",
"axios": "^1.6.7",
"bootstrap": "^5.3.3",
"jquery": "^3.7.1",
"laravel-mix": "^6.0.49",
"lodash": "^4.17.21",
"resolve-url-loader": "^5.0.0",
"sass": "^1.71.1",
"sass-loader": "^14.1.1"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.1",
"datatables.net-bs5": "^1.13.7",
"datatables.net-responsive-bs5": "^2.5.0",
"daterangepicker": "^3.1.0",
"moment": "^2.30.1",
"toastr": "^2.1.4"
}
}

33
phpunit.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>app</directory>
</include>
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
<env name="MAIL_MAILER" value="array"/>
<env name="PULSE_ENABLED" value="false"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="array"/>
<env name="TELESCOPE_ENABLED" value="false"/>
</php>
</phpunit>

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

25
public/.htaccess Normal file
View File

@ -0,0 +1,25 @@
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Handle X-XSRF-Token Header
RewriteCond %{HTTP:x-xsrf-token} .
RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
public/css/app.css Normal file
View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

10003
public/css/bootstrap.min.css vendored Normal file

File diff suppressed because it is too large Load Diff

974
public/css/custom.css Normal file
View File

@ -0,0 +1,974 @@
@import url('https://fonts.googleapis.com/css?family=Nova+Slim&display=swap');
body,
html {
line-height: 1.8;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
color: #555e58;
text-transform: capitalize;
text-rendering: optimizeLegibility !important;
-webkit-font-smoothing: antialiased !important;
font-weight: 400;
margin: 0px;
padding: 0px;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4 {
font-weight: 400;
line-height: 1.5em;
}
p {
font-size: 15px;
margin: 12px 0 0;
line-height: 24px;
}
a {
color: #333;
font-weight: 400;
}
button:focus {
box-shadow: none;
outline: none;
border: none;
}
button {
cursor: pointer;
}
ul,
ol {
padding: 0;
margin: 0px;
list-style: none;
}
a,
a:hover,
a:focus {
color: #333;
text-decoration: none;
transition: all 0.3s;
}
/*=======================================================
material-icons copy & paste form site google material-icons
==================================================*/
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://example.com/MaterialIcons-Regular.eot);
/* For IE6-8 */
src: local('Material Icons'),
local('MaterialIcons-Regular'),
url(https://example.com/MaterialIcons-Regular.woff2) format('woff2'),
url(https://example.com/MaterialIcons-Regular.woff) format('woff'),
url(https://example.com/MaterialIcons-Regular.ttf) format('truetype');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
/* Preferred icon size */
display: inline-block;
line-height: 1;
text-transform: none;
letter-spacing: normal;
word-wrap: normal;
white-space: nowrap;
direction: ltr;
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;
/* Support for Firefox. */
-moz-osx-font-smoothing: grayscale;
/* Support for IE. */
font-feature-settings: 'liga';
}
/*=======================================================
material-icons copy & paste form site google material-icons
==================================================*/
.wrapper {
position: relative;
width: 100%;
overflow: auto;
}
/* ---------------------------------------------------
SIDEBAR STYLE start
----------------------------------------------------- */
#sidebar {
position: fixed;
height: 100vh !important;
top: 0;
bottom: 0;
left: 0;
z-index: 11;
width: 260px;
overflow: auto;
transition: all 0.3s;
background: #FFFFFF;
box-shadow: 0 10px 30px -12px rgb(0 0 0 / 42%), 0 4px 25px 0px rgb(0 0 0 / 12%), 0 8px 10px -5px rgb(0 0 0 / 20%);
}
#sidebar::-webkit-scrollbar {
width: 5px;
border-radius: 10px;
background-color: #eee;
display: none;
}
#sidebar::-webkit-scrollbar-thumbs {
width: 5px;
border-radius: 10px;
background-color: #333;
display: none;
}
#sidebar:hover::-webkit-scrollbar {
display: block;
}
#sidebar:hover::-webkit-scrollbar-thumbs {
display: block;
}
#sidebar .sidebar-header {
padding: 20px;
background-color: #ffffff;
border-bottom: 1px solid #eee;
}
.sidebar-header h3 {
color: #333;
font-size: 17px;
margin: 0px;
text-transform: uppercase;
transition: all 0.5s ease;
font-weight: 600;
}
.sidebar-header h3 img {
width: 120px;
margin-right: 10px;
}
#sidebar ul li {
padding: 2px 7px;
}
#sidebar ul li.active>a {
color: #333;
background-color: rgba(200, 200, 200, 0.2);
}
#sidebar ul li a:hover {
color: #333;
background-color: rgba(200, 200, 200, 0.2);
}
.dropdown-toggle::after {
position: absolute;
right: 10px;
top: 23px;
}
#sidebar ul li.drodown {
position: sticky;
}
#sidebar ul.components {
padding: 20px 0;
}
#sidebar ul li a {
padding: 10px;
line-height: 30px;
border-radius: 5px;
font-size: 15px;
position: relative;
font-weight: 400;
display: block;
}
#sidebar ul li a span {
text-transform: capitalize;
display: inline-block;
}
#sidebar ul li a i {
position: relative;
margin-right: 10px;
top: 5px;
color: #555555;
margin-left: 10px;
}
/* ---------------------------------------------------
sidebar end
----------------------------------------------------- */
/*=======================================================
main-content navbar-design start
===============================================*/
#content {
position: relative;
transition: all 0.3s;
background-color: #EEEEEE;
}
.top-navbar {
width: 100%;
z-index: 9;
position: relative;
}
.main-content {
padding: 10px 20px 0px 20px;
position: relative;
width: 100%;
}
.navbar {
background-color: #2196F3;
color: #FFFFFF;
}
.navbar-brand {
color: #FFFFFF;
}
.navbar button {
background-color: transparent;
border: none;
}
.navbar button span {
color: #fff;
}
#sidebarCollapse {
border-radius: 50%;
width: 45px;
height: 45px;
text-align: center;
line-height: 45px;
margin-right: 20px;
border: none;
color: #FFFFFF;
background-color: rgba(0, 0, 0, 0.09);
}
#sidebarCollapse span {
margin: 9px;
padding: 0px;
}
.navbar-nav>li.active {
color: #FFFFFF;
border-radius: 4px;
background-color: rgba(0, 0, 0, 0.08);
}
.navbar-nav>li>a {
color: #FFFFFF;
}
.navbar .notification {
position: absolute;
top: 5px;
right: 10px;
display: block;
font-size: 9px;
border: 0px;
font-size: 10px;
background: #d9534f;
min-width: 15px;
text-align: center;
padding: 1px 5px;
height: 15px;
border-radius: 2px;
line-height: 14px;
}
.navbar-nav>li.show .dropdown-menu {
transform: translate3d(0, 0, 0);
opacity: 1;
visibility: visible;
}
.dropdown-menu li>a {
font-size: 13px;
padding: 10px 20px;
margin: 0 5px;
border-radius: 2px;
font-weight: 400;
transition: all 150ms linear;
}
.navbar-nav>.active>a:focus {
color: #FFFFFF;
background-color: rgba(0, 0, 0, 0.08);
}
.navbar-nav li a {
position: relative;
display: block;
padding: 10px 15px !important;
}
/*=======================================================
main-content navbar-design end
===============================================*/
/*=======================================================
main-content navbar-design start
===============================================*/
/*=======================================================
main-content inner design like card start
===============================================*/
.card {
margin: 10px 0;
}
.card {
border-radius: 0px !important;
}
.card {
display: inline-block;
position: relative;
border: none !important;
width: 100%;
margin: 15px 0;
box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
border-radius: 6px;
color: rgba(0, 0, 0, 0.87);
background: #fff;
}
.card-stats .card-header {
float: left;
text-align: center;
}
.card .card-header {
padding: 15px 20px 0;
z-index: 3;
background-color: #fff !important;
border-bottom: none;
}
.card .card-footer .stats .material-icons {
position: relative;
top: 4px;
font-size: 16px;
}
.card-stats .card-header span {
font-size: 36px;
line-height: 56px;
width: 56px;
height: 56px;
}
.icon.icon-warning {
color: #ff9800;
}
.icon.icon-rose {
color: #e91e63;
}
.icon.icon-success {
color: #4caf50;
}
.icon.icon-info {
color: #00bcd4;
}
.card .card-footer {
margin: 0 7px 0px;
padding-top: 10px;
background-color: #fff;
border-top: 1px solid #eeeeee;
}
.text-info {
color: #03A9F4 !important;
}
.card-stats .card-content {
text-align: right;
padding-top: 10px;
}
.card .card-content {
padding: 15px 20px;
position: relative;
}
.card .card-content .category {
margin-bottom: 0;
}
.card .category:not([class*="text-"]) {
color: #555555;
font-size: 14px;
font-weight: 400;
}
.card .card-title:not(.card-calendar .card-title) {
margin-top: 0;
margin-bottom: 5px;
}
.card-stats .card-title {
margin: 0;
}
.card .card-footer .stats {
line-height: 22px;
color: #555555;
font-size: 15px;
}
.card .card-footer div {
display: inline-block;
}
.card .card-header-text h4 {
margin-top: 0;
margin-bottom: 3px;
font-size: 19px;
font-weight: 400;
color: #222222;
text-decoration: none;
}
.table>thead>tr>th {
border-bottom-width: 1px;
font-size: 16px;
font-weight: 400;
}
.card .card-content {
padding: 15px 20px;
position: relative;
}
.streamline .sl-primary {
border-left-color: #188ae2;
}
.streamline .sl-item {
position: relative;
padding-bottom: 12px;
border-left: 1px solid #ccc;
}
.streamline .sl-item:before {
content: '';
position: absolute;
left: -6px;
top: 0;
background-color: #ccc;
width: 12px;
height: 12px;
border-radius: 100%;
}
.streamline .sl-primary:before,
.streamline .sl-primary:last-child:after {
background-color: #188ae2;
}
.streamline .sl-danger:before,
.streamline .sl-danger:last-child:after {
background-color: #ff5b5b;
}
.streamline .sl-success {
border-left-color: #10c469;
}
.streamline .sl-success:before,
.streamline .sl-success:last-child:after {
background-color: #10c469;
}
.streamline .sl-warning {
border-left-color: #f9c851;
}
.streamline .sl-warning:before,
.streamline .sl-warning:last-child:after {
background-color: #f9c851;
}
.streamline .sl-danger {
border-left-color: #ff5b5b;
}
.streamline .sl-item .sl-content {
margin-left: 24px;
}
.streamline .sl-item .text-muted {
color: inherit;
opacity: .6;
font-size: 12px;
}
.streamline .sl-item p {
font-size: 14px;
color: #333;
}
/*=======================================================
main-content inner design like card end
===============================================*/
/*=============================================
footer design start
=========================================*/
.footer {
border-top: 1px solid #e7e7e7;
}
footer {
padding: 10px 0;
position: relative;
width: 100%;
}
footer ul li {
display: inline-block;
}
footer ul li a {
color: inherit;
padding: 15px;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
border-radius: 3px;
text-decoration: none;
position: relative;
display: block;
}
footer .copyright {
padding: 15px;
font-size: 14px;
margin: 0;
}
/*=============================================
footer design end
=========================================*/
#sidebar.show-nav,
.body-overlay.show-nav {
transform: translatex(0%);
opacity: 1;
display: block;
visibility: visible;
z-index: 15;
}
/* ---------------------------------------------------
MEDIAQUERIES
----------------------------------------------------- */
@media only screen and (min-width:992px) {
#sidebar.active {
width: 80px;
height: 100% !important;
position: absolute !important;
overflow: visible !important;
top: 0 !important;
z-index: 666;
float: left !important;
bottom: 0 !important;
}
#sidebar.active .sidebar-header h3 span {
display: none;
transition: all 0.5s ease;
}
#sidebar.active ul li a span {
display: none;
transition: all 0.5s ease;
}
#sidebar.active .dropdown-toggle::after {
display: none;
transition: all 0.5s ease;
}
#content {
width: calc(100% - 260px);
position: relative;
float: right;
transition: all 0.3s;
background-color: #EEEEEE;
}
#content.active {
width: calc(100% - 80px);
}
#sidebar.active .menu {
position: absolute;
left: 81px;
background-color: white;
width: 180px;
height: auto;
margin: 5px 0;
top: 0;
border: 1px solid #dcd9d9;
z-index: 4;
}
}
@media only screen and (min-width:992px) {
.dropdown-menu {
border: 0;
box-shadow: 0 2px 5px 0 rgb(0 0 0 / 26%);
transform: translate3d(0, -20px, 0);
visibility: hidden;
transition: all 150ms linear;
display: block;
min-width: 15rem;
right: 0;
left: auto;
opacity: 0;
}
}
/*===============small-screen overlay sidebar design media queries==============*/
@media only screen and (max-width:992px) {
#sidebar {
position: fixed;
top: 0;
bottom: 0;
z-index: 10;
width: 260px;
transform: translatex(-100%);
transition: all 150ms linear;
box-shadow: none !important;
}
.body-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
visibility: hidden;
opacity: 0;
z-index: 3;
transition: all 150ms linear;
background-color: rgba(0, 0, 0, 0.5);
}
}
/*===============small-screen overlay sidebar design media queries==============*/
/* ---------------------------------------------------
MEDIAQUERIES
----------------------------------------------------- */
/* Global Styles */
body {
font-family: 'Roboto', sans-serif;
background-color: #f8f9fa;
}
.wrapper {
display: flex;
width: 100%;
min-height: 100vh;
}
#content {
width: 100%;
padding: 20px;
transition: all 0.3s;
}
/* Card Styles */
.card {
border: none;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
margin-bottom: 20px;
}
.card-header {
background-color: transparent;
border-bottom: 1px solid #eee;
padding: 1.25rem;
}
.card-title {
margin-bottom: 0;
color: #333;
font-weight: 500;
}
/* Table Styles */
.table {
margin-bottom: 0;
}
.table th {
border-top: none;
font-weight: 500;
color: #333;
background-color: #f8f9fa;
}
.table td {
vertical-align: middle;
}
/* Form Styles */
.form-control {
border-radius: 5px;
border: 1px solid #ced4da;
padding: 0.5rem 0.75rem;
}
.form-control:focus {
border-color: #E74610;
box-shadow: 0 0 0 0.2rem rgba(231, 70, 16, 0.25);
}
/* Button Styles */
.btn-primary {
background-color: #E74610;
border-color: #E74610;
}
.btn-primary:hover {
background-color: #d63d0c;
border-color: #d63d0c;
}
.btn-outline-primary {
color: #E74610;
border-color: #E74610;
}
.btn-outline-primary:hover {
background-color: #E74610;
border-color: #E74610;
}
/* Badge Styles */
.badge {
padding: 0.5em 0.75em;
font-weight: 500;
border-radius: 5px;
}
.badge-success {
background-color: #28a745;
}
.badge-danger {
background-color: #dc3545;
}
.badge-warning {
background-color: #ffc107;
color: #333;
}
.badge-info {
background-color: #17a2b8;
}
/* Modal Styles */
.modal-content {
border: none;
border-radius: 10px;
}
.modal-header {
border-bottom: 1px solid #eee;
padding: 1.25rem;
}
.modal-footer {
border-top: 1px solid #eee;
padding: 1.25rem;
}
/* DataTables Styles */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
background: #E74610;
border-color: #E74610;
color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
background: #d63d0c;
border-color: #d63d0c;
color: #fff !important;
}
/* Toastr Styles */
.toast-success {
background-color: #28a745;
}
.toast-error {
background-color: #dc3545;
}
.toast-info {
background-color: #17a2b8;
}
.toast-warning {
background-color: #ffc107;
}
/* Responsive Styles */
@media (max-width: 768px) {
#content {
padding: 15px;
}
.card-header {
padding: 1rem;
}
.table th,
.table td {
padding: 0.5rem;
}
.btn {
padding: 0.375rem 0.75rem;
font-size: 0.875rem;
}
}
/* Utility Classes */
.cursor-pointer {
cursor: pointer;
}
.text-primary {
color: #E74610 !important;
}
.bg-primary {
background-color: #E74610 !important;
}
.border-primary {
border-color: #E74610 !important;
}

129
public/css/style.css Normal file
View File

@ -0,0 +1,129 @@
* {
margin: 0;
padding: 0; }
*,
::after,
::before {
-webkit-box-sizing: border-box;
box-sizing: border-box; }
a {
text-decoration: none;
-webkit-transition: all 0.5s ease-in-out 0s;
-o-transition: all 0.5s ease-in-out 0s;
transition: all 0.5s ease-in-out 0s; }
a:hover {
text-decoration: none; }
/*-----------------------------
News Ticker
------------------------------*/
.acme-news-ticker {
background: #fff;
position: relative;
height: 45px;
border: 1px solid #1974d2;
margin-top: 45px; }
@media (min-width: 768px) {
.acme-news-ticker {
margin-top: 0; } }
.acme-news-ticker-label {
background: #1974d2;
padding: 10px;
width: auto;
float: left;
margin-right: 15px;
line-height: normal;
height: 100%;
color: #fff; }
@media (max-width: 575px) {
.acme-news-ticker-label {
position: absolute;
top: -45px; } }
.acme-news-ticker-box {
height: 100%;
padding-top: 10px;
overflow: hidden; }
@media (max-width: 575px) {
.acme-news-ticker-box {
padding-left: 10px;
padding-right: 120px; } }
.acme-news-ticker-box ul {
width: 100%;
list-style-type: none !important;
padding: 0;
margin: 0; }
.acme-news-ticker-box ul li a {
text-decoration: none; }
.acme-news-ticker-controls {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
position: absolute;
height: 100%;
right: 0;
top: 0; }
.acme-news-ticker-controls button {
height: 100%;
background: #f6f6f6;
padding: 0;
width: 40px;
border-color: #eeeeee;
border-style: solid;
border-width: 0 0 0 1px;
cursor: pointer;
display: inline-block; }
.acme-news-ticker-controls button:hover {
background: #eeeeee; }
.acme-news-ticker-controls button.acme-news-ticker-arrow {
margin: 0;
display: inline-block;
position: relative; }
.acme-news-ticker-controls button.acme-news-ticker-arrow:after {
border-color: #999;
border-bottom-style: solid;
border-bottom-width: 2px;
border-right-style: solid;
border-right-width: 2px;
content: '';
display: inline-block;
height: 8px;
left: 50%;
position: absolute;
top: 50%;
width: 8px; }
.acme-news-ticker-controls button.acme-news-ticker-pause {
position: relative;
display: inline-block; }
.acme-news-ticker-controls button.acme-news-ticker-pause:before {
position: absolute;
content: "";
width: 10px;
height: 10px;
border-color: #999;
border-style: solid;
border-width: 0 2px 0;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
left: 50%;
top: 50%; }
.acme-news-ticker-controls.acme-news-ticker-horizontal-controls button.acme-news-ticker-prev:after {
-webkit-transform: translate(-50%, -50%) rotate(135deg);
-ms-transform: translate(-50%, -50%) rotate(135deg);
transform: translate(-50%, -50%) rotate(135deg); }
.acme-news-ticker-controls.acme-news-ticker-horizontal-controls button.acme-news-ticker-next:after {
-webkit-transform: translate(-50%, -50%) rotate(315deg);
-ms-transform: translate(-50%, -50%) rotate(315deg);
transform: translate(-50%, -50%) rotate(315deg); }
.acme-news-ticker-controls.acme-news-ticker-vertical-controls button.acme-news-ticker-prev:after {
-webkit-transform: translate(-50%, -50%) rotate(225deg);
-ms-transform: translate(-50%, -50%) rotate(225deg);
transform: translate(-50%, -50%) rotate(225deg); }
.acme-news-ticker-controls.acme-news-ticker-vertical-controls button.acme-news-ticker-next:after {
-webkit-transform: translate(-50%, -50%) rotate(405deg);
-ms-transform: translate(-50%, -50%) rotate(405deg);
transform: translate(-50%, -50%) rotate(405deg); }
/*# sourceMappingURL=style.css.map */

0
public/favicon.ico Normal file
View File

BIN
public/img/bg_cms.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

BIN
public/img/card.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

1
public/img/ic_error.svg Normal file
View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 57.834 57.955"><defs><style>.a{fill:#f4825c;stroke:#707070;}.b{fill:#e74610;}.c{stroke:none;}.d{fill:none;}</style></defs><g transform="translate(-0.498 0.199)"><g transform="translate(0 0)"><g class="a" transform="translate(1.009 0.934)"><circle class="c" cx="27.989" cy="27.989" r="27.989"/><circle class="d" cx="27.989" cy="27.989" r="27.489"/></g><g transform="translate(-26.502 -27.6)"><g transform="translate(27 27.4)"><path class="b" d="M55.917,85.355A28.978,28.978,0,1,1,84.834,56.317,29.012,29.012,0,0,1,55.917,85.355Zm0-54.31A25.272,25.272,0,1,0,81.189,56.317,25.253,25.253,0,0,0,55.917,31.045Z" transform="translate(-27 -27.4)"/><g transform="translate(18.529 18.65)"><path class="b" d="M59.638,63.344a1.827,1.827,0,0,1-1.337-.486l-8.5-8.5a1.762,1.762,0,0,1,0-2.551l8.5-8.5a1.8,1.8,0,0,1,2.551,2.551l-7.168,7.168,7.168,7.169a1.762,1.762,0,0,1,0,2.551A1.234,1.234,0,0,1,59.638,63.344Z" transform="translate(-40.745 -42.75)"/><path class="b" d="M44.133,63.323a1.827,1.827,0,0,1-1.336-.486,1.762,1.762,0,0,1,0-2.551l7.169-7.169L42.8,45.948A1.8,1.8,0,0,1,45.348,43.4l8.5,8.5a1.762,1.762,0,0,1,0,2.551l-8.5,8.5A1.814,1.814,0,0,1,44.133,63.323Z" transform="translate(-42.25 -42.729)"/></g></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 58.184 58.184"><defs><style>.a{fill:#56b68b;stroke:#707070;}.b{fill:#018952;fill-rule:evenodd;}.c{stroke:none;}.d{fill:none;}</style></defs><g transform="translate(-138.502 -248.613)"><g transform="translate(138.502 248.613)"><g transform="translate(0 0)"><g class="a" transform="translate(1.009 0.934)"><circle class="c" cx="27.989" cy="27.989" r="27.989"/><circle class="d" cx="27.989" cy="27.989" r="27.489"/></g><path class="b" d="M47.664,22.747l2.3,2.3L31.8,43.209l-2.3,2.3-2.3-2.3-8.978-8.978,2.3-2.3L29.5,40.913ZM34.092,5A29.092,29.092,0,1,1,5,34.092,29.079,29.079,0,0,1,34.092,5Zm0,3.967A25.16,25.16,0,1,1,8.967,34.092,25.173,25.173,0,0,1,34.092,8.967Z" transform="translate(-5 -5)"/></g></g></g></svg>

After

Width:  |  Height:  |  Size: 763 B

BIN
public/img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
public/img/logo_unioil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

17
public/index.php Normal file
View File

@ -0,0 +1,17 @@
<?php
use Illuminate\Http\Request;
define('LARAVEL_START', microtime(true));
// Determine if the application is in maintenance mode...
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
require $maintenance;
}
// Register the Composer autoloader...
require __DIR__.'/../vendor/autoload.php';
// Bootstrap Laravel and handle the request...
(require_once __DIR__.'/../bootstrap/app.php')
->handleRequest(Request::capture());

3
public/js/app.js Normal file
View File

@ -0,0 +1,3 @@
import './bootstrap';
import axios from 'axios';
window.axios = axios; // Make axios globally available

4
public/js/bootstrap.js vendored Normal file
View File

@ -0,0 +1,4 @@
import axios from 'axios';
window.axios = axios;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

7
public/js/bootstrap.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More