fix check quyền user admin ở page ticket and tracking
This commit is contained in:
		
							parent
							
								
									b9ecfa5da2
								
							
						
					
					
						commit
						ebe031afac
					
				| 
						 | 
					@ -221,9 +221,8 @@ class TicketController extends Controller
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $formattedStartDate = Carbon::createFromFormat('Y-m-d', $startDate)->format('d/m/Y');
 | 
					        $formattedStartDate = Carbon::createFromFormat('Y-m-d', $startDate)->format('d/m/Y');
 | 
				
			||||||
        $formattedEndDate = Carbon::createFromFormat('Y-m-d', $endDate)->format('d/m/Y');
 | 
					        $formattedEndDate = Carbon::createFromFormat('Y-m-d', $endDate)->format('d/m/Y');
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
        $user = auth('admins')->user();
 | 
					        $user = auth('admins')->user();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $ticket = Ticket::create([
 | 
					        $ticket = Ticket::create([
 | 
				
			||||||
            'start_date' => Carbon::create($startDate)->setTimezone(env('TIME_ZONE')),
 | 
					            'start_date' => Carbon::create($startDate)->setTimezone(env('TIME_ZONE')),
 | 
				
			||||||
            'start_period' => $startPeriod,
 | 
					            'start_period' => $startPeriod,
 | 
				
			||||||
| 
						 | 
					@ -236,7 +235,7 @@ class TicketController extends Controller
 | 
				
			||||||
        ]);
 | 
					        ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Send notification email to admin (list)
 | 
					        // Send notification email to admin (list)
 | 
				
			||||||
        $admins = Admin::where('permission', 'admin')->get();
 | 
					        $admins = Admin::where('permission', 'like', '%admin%')->get();
 | 
				
			||||||
        foreach ($admins as $key => $value) {
 | 
					        foreach ($admins as $key => $value) {
 | 
				
			||||||
            $data = array(
 | 
					            $data = array(
 | 
				
			||||||
                "email_template" => "email.notification_tickets",
 | 
					                "email_template" => "email.notification_tickets",
 | 
				
			||||||
| 
						 | 
					@ -379,7 +378,6 @@ class TicketController extends Controller
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $this->createOrUpdateRecordForCurrentMonth($month, $year);
 | 
					            $this->createOrUpdateRecordForCurrentMonth($month, $year);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // $admins = Admin::where('permission', 'admin')->get();
 | 
					 | 
				
			||||||
            // Send notification email to users
 | 
					            // Send notification email to users
 | 
				
			||||||
            $data = array(
 | 
					            $data = array(
 | 
				
			||||||
                "email_template" => "email.notification_tickets_user",
 | 
					                "email_template" => "email.notification_tickets_user",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,8 @@ class TrackingController extends Controller
 | 
				
			||||||
            ['status' => true]
 | 
					            ['status' => true]
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $users = Admin::where('permission', '!=', 'admin')->get();
 | 
					        // $users = Admin::where('permission', '!=', 'admin')->get();
 | 
				
			||||||
 | 
					        $users = Admin::where('permission', 'not like', '%admin%')->get();
 | 
				
			||||||
        $responseData['users'] = $users;
 | 
					        $responseData['users'] = $users;
 | 
				
			||||||
        return response()->json($responseData);
 | 
					        return response()->json($responseData);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue