fix changes

This commit is contained in:
Ritikesh yadav
2024-04-04 19:13:00 +05:30
parent 33c6f4c8e1
commit 2ef6020db5
28 changed files with 845 additions and 453 deletions

View File

@@ -28,13 +28,14 @@ class HomeController extends Controller
public function index()
{
// dd($this->getAllTopPickProducts());
return view('Frontend.Pages.index',[
return view('Frontend.Pages.index', [
'topPicks' => $this->getAllTopPickProducts()
]);
}
public function getAllTopPickProducts(){
$data['data'] = Product::getAllDetails()->where('top_pick',true)->get();
public function getAllTopPickProducts()
{
$data['data'] = Product::getAllDetails()->where('top_pick', true)->get();
// foreach($data['data'] as $row)
// {
// $category = Category::where('category_name', '=', $row->category_name)->first();
@@ -43,9 +44,10 @@ class HomeController extends Controller
return $data;
}
public function productFilter(Request $request){
$userInput = trim($request->filter[0],'[,]');
public function productFilter(Request $request)
{
$userInput = trim($request->filter[0], '[,]');
$minimumInvestment = [
1 => [
// 'symbol' => '>',
@@ -78,7 +80,7 @@ class HomeController extends Controller
$key['indian-real-assets'] = true;
$key['global-financial-assets'] = false;
$key['global-real-assets'] = true;
foreach (explode(',',$userInput) as $filter) {
foreach (explode(',', $userInput) as $filter) {
if ($key['indian-financial-assets'] == false) {
$key['indian-financial-assets'] = $this->checkIFAFilter($minimumInvestment[$filter]['less_than'], $minimumInvestment[$filter]['greater_than']);
}
@@ -120,12 +122,12 @@ class HomeController extends Controller
if (!auth()->guard('users')->check()) {
return response()->json(['status' => 201, 'message' => 'Please Login To Invest']);
}
$checkUserBlock = User::where(['id' => auth()->guard('users')->user()->id, 'status' => 1 ])->doesntExist();
if($checkUserBlock){
$checkUserBlock = User::where(['id' => auth()->guard('users')->user()->id, 'status' => 1])->doesntExist();
if ($checkUserBlock) {
return response()->json(['status' => 403, 'message' => "Please contact us"]);
}
$addLead = Lead::create([
'users_id' => auth()->guard('users')->user()->id,
'lead_owner' => null,
@@ -139,7 +141,8 @@ class HomeController extends Controller
if ($addLead) {
$userName = auth()->guard('users')->user()->name;
$notify['message'] = "$userName is interested in a product!";
$type = "Buyer Form";
// $type = "Buyer Form";
$type = "New Leads";
$users = User::admins()->get();
foreach ($users as $data) {
$data->notify(new UserAdmin($notify, $type));
@@ -197,37 +200,37 @@ class HomeController extends Controller
{
$user = User::find($request->user()->id);
$dataArray = array();
foreach($user->unreadNotifications as $data)
{
foreach ($user->unreadNotifications as $data) {
$notify['id'] = $data->id;
$notify['message'] = $data->data['message'];
$notify['time'] = $data->created_at->diffForHumans();
array_push($dataArray,$notify);
array_push($dataArray, $notify);
}
// array_push($notificationArray,$dataArray);
$notificationArray['data'] = $dataArray;
return $notificationArray;
}
public function updateSingleNotification($id){
if(!$id){
return response()->json(['status' => 400, 'message' => 'Error Marking it as read!'],400);
public function updateSingleNotification($id)
{
if (!$id) {
return response()->json(['status' => 400, 'message' => 'Error Marking it as read!'], 400);
};
$user = User::find(request()->user()->id);
$user->notifications->where('id', $id)->markAsRead();
return response()->json(['status' => 200, 'message' => 'Notification mark as read']);
}
public function checkPin(Request $request){
if(!$request->pin){
return response()->json(['message'=> 'Please Enter Pin!'],400);
public function checkPin(Request $request)
{
if (!$request->pin) {
return response()->json(['message' => 'Please Enter Pin!'], 400);
}
$pin = User::find($request->user()->id);
if($request->pin == $pin->pin){
return response()->json(['message'=> 'Pin Matched!'],200);
if ($request->pin == $pin->pin) {
return response()->json(['message' => 'Pin Matched!'], 200);
}
return response()->json(['message'=> 'Pin did not matched!'],400);
return response()->json(['message' => 'Pin did not matched!'], 400);
}
public function validationError($validator)