Add state in register
This commit is contained in:
@@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Database\QueryException;
|
||||
use App\Models\IamPrincipal;
|
||||
use App\Models\ManageState;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -50,6 +51,22 @@ class AuthController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 06 Feb 2024
|
||||
* Use : Restaurant Details.
|
||||
*/
|
||||
public function viewstates()
|
||||
{
|
||||
try {
|
||||
$response = $this->AuthServices->viewstates();
|
||||
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('FAW get data controller function failed: ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 24 May 2024
|
||||
@@ -60,6 +77,7 @@ class AuthController extends Controller
|
||||
try {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'first_name' => 'required|string|min:2|max:100',
|
||||
'last_name' => 'required|string|min:2|max:100',
|
||||
'email_address' => [
|
||||
'required',
|
||||
'string',
|
||||
@@ -84,7 +102,9 @@ class AuthController extends Controller
|
||||
},
|
||||
],
|
||||
'phone_number' => 'required|min:10',
|
||||
'address_line1' => 'required|max:50',
|
||||
// 'address_line1' => 'required|max:50',
|
||||
'state_xid' => 'required',
|
||||
|
||||
]);
|
||||
|
||||
|
||||
@@ -128,7 +148,7 @@ class AuthController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 24 May 2024
|
||||
* Use : forgot password.
|
||||
@@ -156,7 +176,6 @@ class AuthController extends Controller
|
||||
return jsonResponseWithErrorMessageApi($validationErrors, 403);
|
||||
}
|
||||
return $this->AuthServices->forgotPassword($request);
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error('Customer Forgot Password OTP function failed: ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
@@ -193,7 +212,6 @@ class AuthController extends Controller
|
||||
return jsonResponseWithErrorMessageApi($validationErrors, 403);
|
||||
}
|
||||
return $this->AuthServices->verifyOTPForgotPassword($request);
|
||||
|
||||
} catch (Exception $e) {
|
||||
DB::rollBack();
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
|
||||
@@ -201,7 +219,7 @@ class AuthController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 24 May 2024
|
||||
* Use : Change Password.
|
||||
@@ -219,14 +237,13 @@ class AuthController extends Controller
|
||||
return jsonResponseWithErrorMessageApi($validationErrors, 403);
|
||||
}
|
||||
return $this->AuthServices->changePassword($request);
|
||||
|
||||
} catch (Exception $e) {
|
||||
Log::error("An error occurred in " . __METHOD__ . ": " . $e->getMessage());
|
||||
return response()->json(__('something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 24 May 2024
|
||||
* Use : Resend OTP .
|
||||
|
||||
@@ -105,4 +105,27 @@ class CMSApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Created By : sayli Raut
|
||||
* Created at : 24 May 2024
|
||||
* Use : To get priivacy policy detail.
|
||||
*/
|
||||
public function getTermsConditon()
|
||||
{
|
||||
try {
|
||||
$token = readHeaderToken();
|
||||
if ($token) {
|
||||
$customerIamId = $token['sub'];
|
||||
$response = $this->CMSApiServices->getTermsConditon();
|
||||
return jsonResponseWithSuccessMessageApi(__('success.data_fetched_successfully'), $response, 200);
|
||||
} else {
|
||||
return jsonResponseWithErrorMessageApi(__('auth.user_deleted'), 409);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('FAW get data controller function failed: ' . $e->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ class ContactUsApiController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* Created By : Hritik
|
||||
* Created at : 30 JAN 2024
|
||||
* Created By : Sayli Raut
|
||||
* Created at : 27 May 2024
|
||||
* Use : To validate Customer and Restaurant Contact form data
|
||||
*/
|
||||
public function validateContactForm(Request $request)
|
||||
|
||||
@@ -35,6 +35,7 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
'profile_photo',
|
||||
'address_line1',
|
||||
'user_name',
|
||||
'state_xid',
|
||||
'is_active',
|
||||
'notification_status',
|
||||
'deleted_by_admin'
|
||||
|
||||
11
app/Models/ManageState.php
Normal file
11
app/Models/ManageState.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ManageState extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\IamPrincipalOtp;
|
||||
use App\Models\ManageState;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
@@ -35,6 +36,18 @@ class AuthServices
|
||||
}
|
||||
}
|
||||
|
||||
public function viewstates()
|
||||
{
|
||||
try {
|
||||
$data = ManageState::select('id', 'name')->where('is_active', 1)->get()->toArray();
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
Log::error('List sate Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function register($request)
|
||||
{
|
||||
try {
|
||||
@@ -42,13 +55,15 @@ class AuthServices
|
||||
$user = IamPrincipal::create([
|
||||
'one_signal_player_id' => $request->one_signal_player_id,
|
||||
'first_name' => $request->first_name,
|
||||
'last_name' => $request->last_name,
|
||||
'email_address' => $request->email_address,
|
||||
'password' => Hash::make($request->password),
|
||||
'principal_type_xid' => 3, //3 for customer
|
||||
'principal_source_xid' => 2, //2 for mobile
|
||||
'date_of_birth' => $request->date_of_birth,
|
||||
'address_line1' => $request->address_line1,
|
||||
// 'address_line1' => $request->address_line1,
|
||||
'phone_number' => $request->phone_number,
|
||||
'state_xid' =>$request->state_xid,
|
||||
]);
|
||||
DB::commit();
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Log;
|
||||
use App\Models\Faq;
|
||||
use App\Models\NewsArticle;
|
||||
use App\Models\PrivacyPolicy;
|
||||
use App\Models\Termsandconditions;
|
||||
use Exception;
|
||||
|
||||
class CMSApiServices
|
||||
@@ -127,4 +128,20 @@ class CMSApiServices
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTermsConditon()
|
||||
{
|
||||
try {
|
||||
$data['customer'] = Termsandconditions::select('id', 'message')
|
||||
->where('category_xid', '1')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return $data;
|
||||
} catch (Exception $ex) {
|
||||
Log::error('Terms and condition Get service failed : ' . $ex->getMessage());
|
||||
return jsonResponseWithErrorMessageApi(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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('manage_states', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->boolean('is_active')->default(1)->comment('1=Active, 0=Expired');
|
||||
$table->integer('created_by')->nullable();
|
||||
$table->integer('modified_by')->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('manage_states');
|
||||
}
|
||||
};
|
||||
@@ -11,6 +11,7 @@ Route::middleware(['customerApiBasicAuth'])->group(function () {
|
||||
|
||||
|
||||
Route::post('/v1/check-age', [AuthController::class, 'checkAge']);
|
||||
Route::get('/v1/list-states', [AuthController::class, 'viewstates']);
|
||||
Route::post('/v1/register', [AuthController::class, 'register']);
|
||||
Route::post('/v1/login', [AuthController::class, 'login']);
|
||||
Route::post('/v1/forgot-password', [AuthController::class, 'forgotPassword']);
|
||||
@@ -26,10 +27,12 @@ Route::get('/v1/list-of-faqs', [CMSApiController::class, 'getfaq']);
|
||||
Route::get('/v1/list-of-about-us', [CMSApiController::class, 'getAboutUs']);
|
||||
Route::get('/v1/list-of-privacy-policy', [CMSApiController::class, 'getPrivacyPolicy']);
|
||||
Route::get('/v1/list-of-news-articles', [CMSApiController::class, 'getNewsArticles']);
|
||||
Route::get('/v1/list-of-terms-conditions', [CMSApiController::class, 'getTermsConditon']);
|
||||
|
||||
|
||||
//*******************************************************contact us********************************************************
|
||||
|
||||
// Route::post('/v1/contact-us', [ContactUsApiController::class, 'addContactForm']);
|
||||
Route::post('/v1/contact-us', [ContactUsApiController::class, 'addContactForm']);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user