modified session attributes for Dev env| added login dev route for local development

This commit is contained in:
2024-07-09 09:58:14 +00:00
parent 2640a7354f
commit f8c7233427
6 changed files with 87 additions and 77 deletions

View File

@@ -56,3 +56,5 @@ RMS_CTO_PHONE_NUMBER="09380220400"
TELESCOPE_RESPONSE_SIZE_LIMIT=128
DEBUGBAR_ENABLED=false
IS_DEVELOPMENT_ENV=true

View File

@@ -21,7 +21,8 @@ return [
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths' => ['api/public/*', 'public/*'],
// 'paths' => ['api/public/*', 'public/*'],
'paths' => ['*'],
/*
* Matches the request method. `[*]` allows all methods.
@@ -56,5 +57,5 @@ return [
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials' => false,
'supports_credentials' => true,
];

View File

@@ -0,0 +1,5 @@
<?php
return [
'IS_DEVELOPMENT_ENV' => env('IS_DEVELOPMENT_ENV', false),
];

View File

@@ -2,6 +2,9 @@
use Illuminate\Support\Str;
$sameSite = env('IS_DEVELOPMENT_ENV') ? 'none' : null;
$secure = env('IS_DEVELOPMENT_ENV') ? true : false;
return [
/*
@@ -166,7 +169,7 @@ return [
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
'secure' => $secure,
/*
|--------------------------------------------------------------------------
@@ -194,6 +197,6 @@ return [
|
*/
'same_site' => null,
'same_site' => $sameSite,
];

View File

@@ -476,15 +476,5 @@ Route::get('get-constituencies/{province_id}', 'LawmakersController@getConstitue
// Route::get('add-perm', 'DevelopController@addPermissions');
// ////// for 141 toll house rahdar khane ha
Route::middleware('cors:api')->get('/get_road_toll', 'RahdariPointController@get_road_toll_for_141');

View File

@@ -14,6 +14,7 @@ use App\Http\Controllers\Api\ForgotPasswordController;
use App\Models\TarhList;
use App\Models\Contracts;
// use SoapFault;
// use SoapClient;
@@ -1480,28 +1481,36 @@ Route::get('/', function () {
// return redirect(route('v2.dashboard'));
// });
// ///
// \Illuminate\Support\Facades\Route::get('witel', function () {
// $user = User::create([
// 'username' => 'witel',
// 'password' => Hash::make('Witel@fani0')
// ]);
\Illuminate\Support\Facades\Route::get('witel', function () {
$user = User::create([
'username' => 'witel',
'password' => Hash::make('Witel@fani0')
// $sqlFile1 = file_get_contents(storage_path('/sql-files/permissions.sql'));
// $sqlFile2 = file_get_contents(storage_path('/sql-files/provinces.sql'));
// $sqlFile3 = dev(storage_path('/sql-files/cities.sql'));
// $sqlFile4 = file_get_contents(storage_path('/sql-files/edarate_shahri.sql'));
// $sqlFile5 = file_get_contents(storage_path('/sql-files/log_lists.sql'));
// $sqlFile6 = file_get_contents(storage_path('/sql-files/info_items.sql'));
// DB::unprepared($sqlFile1);
// DB::unprepared($sqlFile2);
// DB::unprepared($sqlFile3);
// DB::unprepared($sqlFile4);
// DB::unprepared($sqlFile5);
// DB::unprepared($sqlFile6);
// $user->givePermissionTo(Permission::all());
// return 'ok';
// });
if (config('global_variables.IS_DEVELOPMENT_ENV') === true) {
Route::get('login_dev', function (Request $request) {
$request->validate([
'username' => 'required',
]);
$sqlFile1 = file_get_contents(storage_path('/sql-files/permissions.sql'));
$sqlFile2 = file_get_contents(storage_path('/sql-files/provinces.sql'));
$sqlFile3 = file_get_contents(storage_path('/sql-files/cities.sql'));
$sqlFile4 = file_get_contents(storage_path('/sql-files/edarate_shahri.sql'));
$sqlFile5 = file_get_contents(storage_path('/sql-files/log_lists.sql'));
$sqlFile6 = file_get_contents(storage_path('/sql-files/info_items.sql'));
DB::unprepared($sqlFile1);
DB::unprepared($sqlFile2);
DB::unprepared($sqlFile3);
DB::unprepared($sqlFile4);
DB::unprepared($sqlFile5);
DB::unprepared($sqlFile6);
$user->givePermissionTo(Permission::all());
return 'ok';
Auth::loginUsingId(User::where('username', $request->username)->first()->id);
});
}