Compare commits

..

2 Commits

Author SHA1 Message Date
Mahesh Sharma 564529895f implementing-task-scheduler 2 years ago
Mahesh Sharma cce8fd095a appointment 2 years ago
  1. 36
      app/Console/Commands/CheckQueue.php
  2. 33
      app/Console/Commands/ProcessQueue.php
  3. 2
      app/Console/Kernel.php
  4. 22
      app/Http/Controllers/Admin/AppointmentController.php
  5. 45
      app/Http/Controllers/AppointmentController.php
  6. 2
      app/Http/Controllers/BlogController.php
  7. 1
      app/Http/Controllers/EnquiryController.php
  8. 11
      app/Http/Controllers/HomeController.php
  9. 1
      resources/views/appointment_confirmed.blade.php
  10. 25
      resources/views/appointment_confirmed_for_admin.blade.php
  11. 2
      resources/views/layout/app.blade.php

@ -0,0 +1,36 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Queue;
class CheckQueue extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'queue:check';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check if there is a job in the queue';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$count = Queue::size(); // Get the number of jobs in the queue
if ($count > 0) {
$this->call('queue:process'); // Call the ProcessQueue command if there is a job in the queue
}
}
}

@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Queue;
class ProcessQueue extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'queue:process';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Process the tasks in the queue';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
Queue::daemon(); // Process the tasks in the queue
}
}

@ -15,7 +15,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
$schedule->command('queue:check')->everyMinute();
}
/**

@ -50,7 +50,7 @@ class AppointmentController extends Controller
$appointments = $appointments->where('status', $status);
}
if (\request('is_booked')) {
$is_booked = (\request('is_booked')) == '1' ? true : false;
$appointments = $appointments->where('is_booked', $is_booked);
}
@ -73,11 +73,10 @@ class AppointmentController extends Controller
'date' => 'required|date',
'start_time' => 'required|date_format:H:i',
'end_time' => 'required|date_format:H:i',
// 'location' => 'required|max:255',
// 'description' => 'required',
]);
$start_time = Carbon::createFromFormat('H:i', $request->get('start_time'))->format('H:i A');
$end_time = Carbon::createFromFormat('H:i', $request->get('end_time'))->format('H:i A');
$appointment = new Appointment([
'date' => $request->get('date'),
'start_time' => $start_time,
@ -88,8 +87,13 @@ class AppointmentController extends Controller
]);
$appointment->save();
if($request->get('service_type') == "1"){
$service = 'education';
}else{
$service = 'visa';
}
return redirect($this->redirect)->with('success', 'Appointment has been added');
return redirect($this->redirect.'/'.$service)->with('success', 'Appointment has been added');
}
public function edit($id)
@ -107,12 +111,11 @@ class AppointmentController extends Controller
public function update(Request $request, $id)
{
$request->validate([
'date' => 'required|date',
'start_time' => 'required|date_format:H:i',
'end_time' => 'required|date_format:H:i',
// 'location' => 'required|max:255',
// 'description' => 'required',
]);
$start_time = Carbon::createFromFormat('H:i', $request->get('start_time'))->format('H:i A');
$end_time = Carbon::createFromFormat('H:i', $request->get('end_time'))->format('H:i A');
@ -126,8 +129,13 @@ class AppointmentController extends Controller
$appointment->service_type = $request->get('service_type');
$appointment->status = $request->get('status');
$appointment->save();
if($request->get('service_type') == "1"){
$service = 'education';
}else{
$service = 'visa';
}
return redirect($this->redirect)->with('success', 'Appointment has been updated');
return redirect($this->redirect.'/'.$service)->with('success', 'Appointment has been updated');
}
public function show($id)

@ -75,7 +75,7 @@ class AppointmentController extends Controller
$formated_date = $date->format('M d, Y');
$appointment->is_booked = true;
$appointment->save();
$subject = 'Appointment Confirmed';
$subject = 'Appointment Booked Successfully.';
dispatch(function() use ($name,$email,$phone,$subject,$formated_date,$appointment) {
\Mail::send('appointment_confirmed', array(
@ -96,13 +96,46 @@ class AppointmentController extends Controller
), function($message) use ($subject,$email,$name){
// $subject=($service!= '') ? 'Enquiry for '.$service : 'Contact/Feedback';
$message->subject($subject);
$message->to($email, $name)->subject($subject);
// $message->cc('extratechweb@gmail.com', 'Extratech')->subject($subject);
// $message->cc('suman@extratechs.com.au', 'Extratech')->subject($subject);
// $subject=($service!= '') ? 'Enquiry for '.$service : 'Contact/Feedback';
$message->subject($subject);
// $message->from('admin@eteducation.com.au', 'Admin');
$message->to($email, $name)->subject($subject);
// $message->cc('extratechweb@gmail.com', 'Extratech')->subject($subject);
// $message->cc('admin@eteducation.com.au', 'Extratech')->subject($subject);
});
});
dispatch(function() use ($name,$email,$phone,$subject,$formated_date,$appointment) {
\Mail::send('appointment_confirmed_for_admin', array(
'full_name' =>$name,
'email' =>$email,
'date' => $formated_date,
'start_time' => $appointment['start_time'],
'end_time' => $appointment['end_time'],
'phone' =>$phone,
'subject' =>$subject
), function($message) use ($subject){
// $subject=($service!= '') ? 'Enquiry for '.$service : 'Contact/Feedback';
$message->subject($subject);
// $message->to($email, $name)->subject($subject);
$message->to('mahesh@extratechs.com.au', 'Extratech')->subject($subject);
// $message->cc('admin@eteducation.com.au', 'Extratech')->subject($subject);
});
});
}

@ -9,7 +9,7 @@ use App\Models\Page;
class BlogController extends Controller
{
public function index(){
$page = Page::where(['title' => 'Blog','status' => 1])->first();
$page = Page::where(['title' => 'Blogs','status' => 1])->first();
$blogs = NewsAndUpdate::where('status',1)->get();
return view('blogs',compact('blogs','page'));
}

@ -28,7 +28,6 @@ class EnquiryController extends Controller
}
$marital_status = $request->get('marital_status');
if ($marital_status == 'Widow' || $marital_status == 'Single') {
$request['married_date'] = null;
$request['spouse_academics'] = null;
$request['spouse_work_experience'] = null;

@ -18,15 +18,16 @@ class HomeController extends Controller
}
public function runQueueJobs(){
Artisan::call('queue:listen');
}
public function index(){
}
public function index(){
$sliders = Slider::where('status',1)->get();
$testimonials = Testimonial::where('status',1)->get();
$blogs = NewsAndUpdate::where('status',1)->get();
$about_us = AboutUs::where('status',1)->get();
return view('welcome',compact('sliders','testimonials','blogs','about_us'));
}
public function subscribe(Request $request)
}
public function subscribe(Request $request)
{
$email = $request->email;
@ -50,7 +51,7 @@ class HomeController extends Controller
$message->to('admin@eteducation.com.au', 'Et-Visa')->subject($subject);
$message->cc('extratechweb@gmail.com', 'Extratech')->subject($subject);
$message->cc('suman@extratechs.com.au', 'Extratech')->subject($subject);
});
return response()->json(['success' => 'Thank You for Subscribing !','status' =>'Ok'],200);

@ -19,6 +19,7 @@
<b>Appointment End Time:</b>{{$end_time}}<br /><br />
<b>Your Full Name:</b> {{ $full_name }}<br /><br />
<b>Phone:</b> {{$phone}}<br /><br />
</div>
</div>

@ -0,0 +1,25 @@
<style>
.main-column{
display:flex;
width:100%;
}
.column-one{
width:50%;
}
</style>
<h1>Appointment Confirmed</h1>
<br />
<div class="main-column" style = "display:block; width:100%;">
<div class="column-one" style = "display:block; width:100%;">
<h3>Appointment Details</h3>
<b>Appointment Date: </b>{{$date}}<br /><br />
<b>Appointment Start Time: </b>{{$start_time}}<br /><br />
<b>Appointment End Time: </b>{{$end_time}}<br /><br />
<b>Appointee Full Name: </b> {{ $full_name }}<br /><br />
<b>Phone:</b> {{$phone}}<br /><br />
<b>Email:</b> {{$email}}<br /><br />
</div>
</div>

@ -115,7 +115,7 @@
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="{{url('/blogs')}}">BLOG</a>
<a class="nav-link" href="{{url('/blogs')}}">BLOGS</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{url('contact')}}">CONTACT</a>

Loading…
Cancel
Save