passport fix

This commit is contained in:
erishBRBS 2025-05-16 17:27:06 +08:00
parent 130c71e25d
commit cdc907c061
22 changed files with 166 additions and 107 deletions

4
.env
View File

@ -55,8 +55,8 @@ RNRPHDEV="https://unioilstationlocatorapi.lbteksystems.com/api/"
#PAYMAYA_SANDBOX_SECRET_KEY="sk-X8qolYjy62kIzEbr0QRK1h4b4KDVHaNcwMYk39jInSl:"
PASSPORT_ADMIN_CLIENT_ID=2
PASSPORT_ADMIN_CLIENT_SECRET=fvv0uTTB5mKcxwuoanQRmly9dUqgadbyPNWdXlc1
PASSPORT_ADMIN_CLIENT_ID=9eec8533-a8e7-4c28-b5b3-39c0a4479b1f
PASSPORT_ADMIN_CLIENT_SECRET=UCtG5jPOooiHZUJ8qSNMXajH6qzNxZ9n0VVSe2Ge
M360_BROADCAST_URL=https://smsapi.mobile360.ph/v2/api/broadcast
M360_BROADCAST_USERNAME=unioil

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ npm-debug.log
yarn-error.log
.phpunit.result.cache
storage/oauth/*.key

View File

@ -38,7 +38,14 @@ class InAppNotificationController extends Controller
// Get all Notifications from the Notifications Table
$list = InAppNotifications::all();
if(!count($list)) return $this->format->success("No records found",[]); // Check if notifications are present and return the appropriate response
return response()->json(["code"=>200,"message"=>"SUCCESS","data"=>$otp], 200);
return response()->json([
"code" => 200,
"message" => "SUCCESS",
"data" => [
"notifications" => $list,
"otp" => $otp,
]
], 200);
}
/**

View File

@ -2,25 +2,27 @@
namespace App\Http\Controllers\API;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Contracts\StationResourceInterface;
use App\Contracts\AdminActionLogsInterface;
use App\Contracts\LcardActionLogsInterface;
use App\Contracts\StationFuelPricesInterface;
use App\Contracts\StationFavoriteResourceInterface;
// use App\Http\Resources\StationResource;
use App\Libraries\ParameterHelper;
use App\Helpers\CurrentUserHelper;
use App\Helpers\StringHelper;
use App\Helpers\HttpStatusCode;
use App\Http\Resources\StationLocatorResource;
use App\Http\Resources\StationSearchResource;
use App\Libraries\StratuscastLibrary;
use App\Libraries\RNRPHLibrary;
use App\Libraries\StaticContents;
use App\User;
use App\Admin;
use App\Station;
use App\CodeCity;
use Illuminate\Http\Request;
use App\Helpers\StringHelper;
use App\Helpers\HttpStatusCode;
// use App\Http\Resources\StationResource;
use App\Libraries\RNRPHLibrary;
use App\Libraries\StaticContents;
use App\Helpers\CurrentUserHelper;
use App\Libraries\ParameterHelper;
use App\Http\Controllers\Controller;
use App\Libraries\StratuscastLibrary;
use App\Contracts\AdminActionLogsInterface;
use App\Contracts\LcardActionLogsInterface;
use App\Contracts\StationResourceInterface;
use App\Contracts\StationFuelPricesInterface;
use App\Http\Resources\StationSearchResource;
use App\Http\Resources\StationLocatorResource;
use App\Contracts\StationFavoriteResourceInterface;
class StationController extends Controller
{
@ -139,6 +141,7 @@ class StationController extends Controller
{
$details = $this->station->getByField('is_viewable',1);
if(count($details) > 0)
{
$parsed = array();
@ -146,10 +149,22 @@ class StationController extends Controller
{
if($value['is_active'] == 1)
{
$city = CodeCity::where('city_id', $value['city_id'])->first();
$cityName = $value['city_id'] == 0 ? 'Unassigned' : ($city->name ?? 'Unknown');
$user = User::where('id', $value['created_by'])->first();
$userName = $value['created_by'] == 0 ? 'Unassigned' : ($user->name ?? 'Unknown');
$parsed[] = array(
'station_uuid' => $value['station_uuid'],
'code' => $value['code'],
'description' => $value['description'],
'city' => $cityName,
'created_at' => $value['created_at'],
'created_by' => $userName,
'modified_by' => $value['modified_by'],
'modified_at' => $value['updated_at'],
);
}
}

View File

@ -176,7 +176,7 @@ class UserController extends Controller
$data = [
'grant_type' => 'password',
'client_id' => env("PASSPORT_ADMIN_CLIENT_ID", 2),
'client_id' => env("PASSPORT_ADMIN_CLIENT_ID", 9),
'client_secret' => env("PASSPORT_ADMIN_CLIENT_SECRET", "test"),
'username' => $admin[0]['email'],
'password' => request('password'),

View File

@ -3,6 +3,7 @@
namespace App\Http\Resources;
use App\Contracts\RatingsResourceInterface;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
class ReportMobileUsageResource extends JsonResource
@ -18,7 +19,8 @@ class ReportMobileUsageResource extends JsonResource
$this->withoutWrapping();
return [
'date' => $this->date->toDateString(),
'mba_id' => $this->mba_id,
'date' => Carbon::parse($this->date)->toDateString(),
'active' => $this->active,
'inactive' => $this->inactive,
'locked' => $this->locked,

View File

@ -17,6 +17,7 @@ class ReportStationRatingsResource extends JsonResource
$this->withoutWrapping();
return [
'rating_uuid' => $this->rating_uuid,
'date' => $this->created_at != null ? date('d-M-Y h:i A',strtotime($this->created_at)) : '',
'card_number' => ($this->loyaltyCard) ? $this->loyaltyCard->card_number : '',
'invoice' => isset($this->payment->trans_num)? $this->payment->trans_num : '',

View File

@ -27,6 +27,7 @@ class AppServiceProvider extends ServiceProvider
public function boot()
{
Schema::defaultStringLength(128);
Passport::loadKeysFrom(storage_path('oauth'));
$this->registerPolicies();
// Passport::routes();
}

View File

@ -34,5 +34,8 @@ class AuthServiceProvider extends ServiceProvider
Passport::refreshTokensExpireIn(Carbon::now()->addMonths(10));
Passport::enableImplicitGrant();
Passport::loadKeysFrom(storage_path('oauth'));
}
}

View File

@ -17,7 +17,7 @@ class CustomPassportServiceProvider extends PassportServiceProvider
*
* @return void
*/
public function boot()
public function boot(): void
{
parent::boot();
}
@ -27,7 +27,7 @@ class CustomPassportServiceProvider extends PassportServiceProvider
*
* @return void
*/
public function register()
public function register(): void
{
parent::register();
}
@ -37,7 +37,7 @@ class CustomPassportServiceProvider extends PassportServiceProvider
*
* @return void
*/
protected function registerAuthorizationServer()
protected function registerAuthorizationServer(): void
{
$this->app->singleton(AuthorizationServer::class, function () {
return tap($this->makeAuthorizationServer(), function ($server) {

View File

@ -41,6 +41,10 @@ class LoyaltyCardService implements LoyaltyCardResourceInterface
$pagination = ListHelper::validatePagination($params['page_size'],$params['page']);
$list = LoyaltyCard::with(['personalDetails','codeVehicleOwn','codeCivilStatus','codeGender','codeCardType']);
if (!is_null($params['locked'])) {
$list->where('is_locked', $params['locked']);
}
if($params['search'] != null)
{
// $list = $list->whereHas('personalDetails', function ($query) use ($params) {

View File

@ -23,7 +23,7 @@
},
"require-dev": {
"beyondcode/laravel-dump-server": "^2.0",
"fakerphp/faker": "*",
"fakerphp/faker": "^1.24",
"filp/whoops": "^2.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^8.0",

6
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fd8524023e7a69526ee6118304ac60d3",
"content-hash": "67d63186693e4cb8ee3d78df3abc17a0",
"packages": [
{
"name": "aws/aws-crt-php",
@ -9757,12 +9757,12 @@
],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {},
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": "^8.3.6"
},
"platform-dev": {},
"platform-dev": [],
"plugin-api-version": "2.6.0"
}

46
config/passport.php Normal file
View File

@ -0,0 +1,46 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Passport Guard
|--------------------------------------------------------------------------
|
| Here you may specify which authentication guard Passport will use when
| authenticating users. This value should correspond with one of your
| guards that is already present in your "auth" configuration file.
|
*/
'guard' => 'web',
/*
|--------------------------------------------------------------------------
| Encryption Keys
|--------------------------------------------------------------------------
|
| Passport uses encryption keys while generating secure access tokens for
| your application. By default, the keys are stored as local files but
| can be set via environment variables when that is more convenient.
|
*/
'private_key' => env('PASSPORT_PRIVATE_KEY'),
'public_key' => env('PASSPORT_PUBLIC_KEY'),
/*
|--------------------------------------------------------------------------
| Passport Database Connection
|--------------------------------------------------------------------------
|
| By default, Passport's models will utilize your application's default
| database connection. If you wish to use a different connection you
| may specify the configured name of the database connection here.
|
*/
'connection' => env('PASSPORT_CONNECTION'),
];

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('oauth_device_codes', function (Blueprint $table) {
$table->char('id', 80)->primary();
$table->foreignId('user_id')->nullable()->index();
$table->foreignUuid('client_id')->index();
$table->char('user_code', 8)->unique();
$table->text('scopes');
$table->boolean('revoked');
$table->dateTime('user_approved_at')->nullable();
$table->dateTime('last_polled_at')->nullable();
$table->dateTime('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('oauth_device_codes');
}
/**
* Get the migration connection name.
*/
public function getConnection(): ?string
{
return $this->connection ?? config('passport.connection');
}
};

View File

@ -11,7 +11,7 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
// $this->call(MemberSeeder::class);
$this->call(MemberSeeder::class);
$this->call(AdminUserSeeder::class);
$this->call(CodeGenderSeeder::class);
$this->call(StationTableSeeder::class);
@ -19,11 +19,11 @@ class DatabaseSeeder extends Seeder
$this->call(CodeCivilStatusTableSeeder::class);
$this->call(CodeVehicleOwnTableSeeder::class);
$this->call(SystemPreferenceTableSeeder::class);
// $this->call(TopUpTableSeeder::class);
// $this->call(PaymentsTableSeeder::class);
// $this->call(RatingsTableSeeder::class);
// $this->call(PhotoSliderTableSeeder::class);
// $this->call(MobileAnalyticsTableSeeder::class);
// $this->call(TermsAndPolicyTableSeeder::class);
$this->call(TopUpTableSeeder::class);
$this->call(PaymentsTableSeeder::class);
$this->call(RatingsTableSeeder::class);
$this->call(PhotoSliderTableSeeder::class);
$this->call(MobileAnalyticsTableSeeder::class);
$this->call(TermsAndPolicyTableSeeder::class);
}
}

View File

@ -23,7 +23,7 @@ class MemberSeeder extends Seeder
$loyalty_card = array();
$users = array();
for ($i=1; $i <= 200; $i++)
for ($i=1; $i <= 10; $i++)
{
$uuid = new UuidHelper;
$pd_uuid = $uuid->generate_uuid1();
@ -65,10 +65,10 @@ class MemberSeeder extends Seeder
'gender_id' => 1,
'vo_id' => 1,
'is_validated' => $valitated ? 1 : 0,
'validation_dt' => $valitated ? $valitated : 0,
'is_locked' => $i > 10 ? 1 : 0,
'validation_dt' => $valitated ? $valitated : Null,
'is_locked' => $i > 10 ? 1 : Null,
'lock_code' => $i > 10 ? '01' : '',
'lock_dt' => $i > 10 ? date('Y-m-d H:i:s') : '',
'lock_dt' => $i > 10 ? date('Y-m-d H:i:s') : Null,
'created_at' => $registration,
'last_synchronized' => date('Y-m-d H:i:s'),
);

1
id.PHP_EOL Normal file
View File

@ -0,0 +1 @@
Client ID: .-

View File

@ -15,7 +15,7 @@ use App\Http\Controllers\API\AdminController;
|
*/
// cms login
// cms login done
Route::post('cms/login_username', 'API\UserController@cms_usernameLogin');
Route::post('cms/login_password', 'API\UserController@cms_login');
Route::post('cms/login_changePassword', 'API\UserController@cms_changePassword');

1
secret.PHP_EOL Normal file
View File

@ -0,0 +1 @@
Client Secret: .-

View File

@ -1,51 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAzLI0c0PEyprKQ7Ukzk52zazpvFk8njjCztsg1EE0Ak2YpAPe
rSFaAh5HJacqd3CsTO4xdnPslMEOkGzCwpBHV6F18cNnCH247eU5HbURIFyC7EKB
OEBegXaaqSsJrP2K7XWCoTqKlmTEsWkBVe/QTEN74mBvQh7i+vO+18y8pNEK3cE9
1jHukGV02aeBRP8D945z47p3E7i85O1U8QKT/sX1a26lsnUaptt3pG1cd8gkGbPg
ADOE57jjRVBFliT8oBAL2tcYnVHbaHp+GYqMLpdHFoXy5IpmNZ4aI4Pib6bCUKb8
NqzTffrTKHK/DKJVKzQ1PPp2kuugrHxBeytNTjPpCmkMmhEno6olBXU6+MCRGjNe
y0ABOHkLbyXJ6b6OYCZk7HpUMZ4uJ4/FiDeLuRG0NH7ccek9LD4zBy63R2UGpUb8
MAmgL+SMWwEWs+zAYxk0gQDSUZpcAeHU+3uva/Qe/zUiyKbkX4iqC0oGqJLC+nnR
plUnGKB5agEDjgbxeRbUdaEXXtF5e56nNhQqBG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