Compare commits
No commits in common. 'master' and 'et#19' have entirely different histories.
@ -1,36 +0,0 @@ |
||||
<?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 |
||||
} |
||||
} |
||||
} |
@ -1,33 +0,0 @@ |
||||
<?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 |
||||
} |
||||
} |
@ -0,0 +1,278 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers\Admin; |
||||
|
||||
use App\Http\Controllers\Controller; |
||||
use App\Models\Accomodation; |
||||
use App\Models\BlogPoint; |
||||
use App\Models\NewsAndUpdatePoint; |
||||
use App\Models\Setting; |
||||
use App\Models\User; |
||||
use App\Models\AccomodationFeature; |
||||
use App\Models\AccomodationInformation; |
||||
use App\Models\AccomodationSliderTitle; |
||||
use App\Models\AccomodationImage; |
||||
use Illuminate\Http\Request; |
||||
use Illuminate\Support\Facades\Auth; |
||||
use Illuminate\Support\Facades\Session; |
||||
// use function GuzzleHttp\Promise\all; |
||||
|
||||
class AccomodationController extends Controller |
||||
{ |
||||
protected $view = 'admin.accomodation.'; |
||||
protected $redirect = 'admin/accomodations'; |
||||
|
||||
public function index() |
||||
{ |
||||
$settings = Accomodation::orderBy('id','DESC'); |
||||
|
||||
if(\request('name')){ |
||||
$key = \request('name'); |
||||
$settings = $settings->where('title','like','%'.$key.'%'); |
||||
} |
||||
if(\request('status')){ |
||||
$key = \request('status'); |
||||
$settings = $settings->where('status',$key); |
||||
} |
||||
$settings = $settings->paginate(config('custom.per_page')); |
||||
return view($this->view.'index',compact('settings')); |
||||
} |
||||
|
||||
public function create() |
||||
{ |
||||
return view($this->view . 'create'); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
|
||||
$this->validate(\request(), [ |
||||
'title' => 'required', |
||||
'phone' => 'required', |
||||
'address' => 'required', |
||||
'status' => 'required', |
||||
'images' => 'required', |
||||
'slider_image' => 'required|file|mimes:jpeg,png,jpg' |
||||
]); |
||||
|
||||
if($request->has('slider_image')){ |
||||
|
||||
$extension = \request()->file('slider_image')->getClientOriginalExtension(); |
||||
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder |
||||
$count = rand(100,999); |
||||
$out_put_path = User::save_image(\request()->file('slider_image'),$extension,$count,$image_folder_type); |
||||
$image_path1 = $out_put_path[0]; |
||||
} |
||||
|
||||
$requestData = $request->all(); |
||||
if(isset($image_path1)){ |
||||
$requestData['slider_image'] = $image_path1; |
||||
} |
||||
|
||||
|
||||
// $requestData['slug'] = Setting::create_slug($requestData['keyword']); |
||||
$accomodation = Accomodation::create($requestData); |
||||
|
||||
if($request->hasFile('images')){ |
||||
foreach($request->file('images') as $imagefile) { |
||||
$extension = $imagefile->getClientOriginalExtension(); |
||||
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder |
||||
$count = rand(100,999); |
||||
$out_put_path = User::save_image($imagefile,$extension,$count,$image_folder_type); |
||||
$image_path1 = $out_put_path[0]; |
||||
$accomodation_image = new AccomodationImage(); |
||||
$accomodation_image->accomodation_id = $accomodation->id; |
||||
$accomodation_image->image = $image_path1; |
||||
$accomodation_image->save(); |
||||
|
||||
} |
||||
|
||||
} |
||||
if(\request('feature_name')){ |
||||
foreach (\request('feature_name') as $index => $value){ |
||||
$setting_point = new AccomodationFeature(); |
||||
$setting_point->accomodation_id = $accomodation->id; |
||||
$setting_point->feature_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
if(\request('information_name')){ |
||||
foreach (\request('information_name') as $index => $value){ |
||||
$setting_point = new AccomodationInformation(); |
||||
$setting_point->accomodation_id = $accomodation->id; |
||||
$setting_point->information_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
if(\request('title_name')){ |
||||
foreach (\request('title_name') as $index => $value){ |
||||
$setting_point = new AccomodationSliderTitle(); |
||||
$setting_point->accomodation_id = $accomodation->id; |
||||
$setting_point->title_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
Session::flash('success','Accomodation successfully created'); |
||||
return redirect($this->redirect); |
||||
} |
||||
|
||||
public function show($id) |
||||
{ |
||||
$setting =Accomodation::findorfail($id); |
||||
return view($this->view.'show',compact('setting')); |
||||
} |
||||
|
||||
public function edit($id){ |
||||
$setting =Accomodation::findorfail($id); |
||||
return view($this->view.'edit',compact('setting')); |
||||
} |
||||
|
||||
public function update(Request $request, $id){ |
||||
|
||||
// dd(\request()->all()); |
||||
$setting =Accomodation::findorfail($id); |
||||
$this->validate(\request(), [ |
||||
'title' => 'required', |
||||
'phone' => 'required', |
||||
'address' => 'required', |
||||
'status' => 'required' |
||||
// 'images' => 'required', |
||||
// 'slider_image' => 'required|file|mimes:jpeg,png,jpg' |
||||
]); |
||||
|
||||
if(\request('slider_image')){ |
||||
$this->validate(\request(),[ |
||||
'image' => 'file|mimes:jpeg,png,jpg' |
||||
]); |
||||
if($request->hasFile('slider_image')){ |
||||
$extension = $request->file('slider_image')->getClientOriginalExtension(); |
||||
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder |
||||
$count = rand(100,999); |
||||
$out_put_path = User::save_image($request->file('slider_image'),$extension,$count,$image_folder_type); |
||||
$image_path1 = $out_put_path[0]; |
||||
if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){ |
||||
unlink(public_path().'/'.$setting->slider_image); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
$requestData = $request->all(); |
||||
// $requestData['slug'] = Setting::create_slug($requestData['keyword']); |
||||
if(isset($image_path1)){ |
||||
$requestData['slider_image'] = $image_path1; |
||||
} |
||||
$setting->fill($requestData); |
||||
if($setting->save()){ |
||||
|
||||
if($request->hasFile('images')){ |
||||
|
||||
$accommodation_image = $setting->accommodation_images(); |
||||
$accommodation_image->delete(); |
||||
foreach($request->file('images') as $imagefile) { |
||||
$extension = $imagefile->getClientOriginalExtension(); |
||||
$image_folder_type = array_search('accomodation',config('custom.image_folders')); //for image saved in folder |
||||
$count = rand(100,999); |
||||
$out_put_path = User::save_image($imagefile,$extension,$count,$image_folder_type); |
||||
$image_path1 = $out_put_path[0]; |
||||
// if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){ |
||||
// unlink(public_path().'/'.$setting->slider_image); |
||||
// } |
||||
$accomodation_image = new AccomodationImage(); |
||||
$accomodation_image->accomodation_id = $id; |
||||
$accomodation_image->image = $image_path1; |
||||
$accomodation_image->save(); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
if(\request('feature_name') ){ |
||||
$accommodation_feature = $setting->accommodation_features(); |
||||
$accommodation_feature->delete(); |
||||
foreach (\request('feature_name') as $index => $value){ |
||||
$setting_point = new AccomodationFeature(); |
||||
$setting_point->accomodation_id = $id; |
||||
$setting_point->feature_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
|
||||
if(\request('information_name') ){ |
||||
$accommodation_information = $setting->accommodation_informations(); |
||||
$accommodation_information->delete(); |
||||
foreach (\request('information_name') as $index => $value){ |
||||
$setting_point = new AccomodationInformation(); |
||||
$setting_point->accomodation_id = $id; |
||||
$setting_point->information_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
|
||||
if(\request('title_name') ){ |
||||
$accommodation_title = $setting->accommodation_slider_titles(); |
||||
$accommodation_title->delete(); |
||||
foreach (\request('title_name') as $index => $value){ |
||||
$setting_point = new AccomodationSlidertitle(); |
||||
$setting_point->accomodation_id = $id; |
||||
$setting_point->title_name = $value; |
||||
$setting_point->save(); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
Session::flash('success','Accomodation succesffuly edited.'); |
||||
return redirect($this->redirect); |
||||
|
||||
} |
||||
|
||||
public function delete($id){ |
||||
$setting=Accomodation::findorfail($id); |
||||
// if($setting->accommodation_features->count() > 0){ |
||||
// $setting->accommodation_features()->delete(); |
||||
// } |
||||
// if($setting->accommodation_informations->count() > 0){ |
||||
// $setting->accommodation_informations()->delete(); |
||||
// } |
||||
// if($setting->accommodation_slider_titles->count() > 0){ |
||||
// $setting->accommodation_informations()->delete(); |
||||
// } |
||||
if($setting->delete()){ |
||||
if (is_file(public_path().'/'.$setting->slider_image) && file_exists(public_path().'/'.$setting->slider_image)){ |
||||
unlink(public_path().'/'.$setting->slider_image); |
||||
} |
||||
} |
||||
Session::flash('success','Accomodation successfully is deleted !'); |
||||
return redirect($this->redirect); |
||||
} |
||||
|
||||
public function points_remove($id) |
||||
{ |
||||
if(Auth::user()){ |
||||
$setting = AccomodationFeature::findorfail($id); |
||||
$setting->delete(); |
||||
return response()->json(['point_id' => $id]); |
||||
} |
||||
|
||||
} |
||||
public function information_points_remove($id) |
||||
{ |
||||
if(Auth::user()){ |
||||
$setting = AccomodationInformation::findorfail($id); |
||||
$setting->delete(); |
||||
return response()->json(['point_id' => $id]); |
||||
} |
||||
|
||||
} |
||||
public function slider_points_remove($id) |
||||
{ |
||||
if(Auth::user()){ |
||||
$setting = AccomodationSliderTitle::findorfail($id); |
||||
$setting->delete(); |
||||
return response()->json(['point_id' => $id]); |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
@ -1,76 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use App\Jobs\SendEnquiryMailJob; |
||||
use App\Models\Country; |
||||
use App\Models\Enquiry; |
||||
use Illuminate\Http\Request; |
||||
use Illuminate\Support\Facades\DB; |
||||
use Illuminate\Support\Facades\Session; |
||||
|
||||
|
||||
|
||||
class EnquiryController extends Controller |
||||
{ |
||||
public function form() |
||||
{ |
||||
$countries = Country::all(); |
||||
return view('enquiry-form', compact('countries')); |
||||
} |
||||
|
||||
public function submit(Request $request) |
||||
{ |
||||
$work_experience = $request->get('work_experience'); |
||||
if ($work_experience == 'no') { |
||||
$request['work_experience_details'] = null; |
||||
$request['salary_mode'] = null; |
||||
} |
||||
$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; |
||||
$request['spouse_salary_mode'] = null; |
||||
} |
||||
DB::beginTransaction(); |
||||
try { |
||||
$enquiry = Enquiry::create($request->all()); |
||||
} catch (\Exception $e) { |
||||
DB::rollback(); |
||||
return redirect()->back()->with(['msg' => 'Something went wrong. Please try again!', 'status' => false], 400); |
||||
} |
||||
DB::commit(); |
||||
dispatch(new SendEnquiryMailJob($enquiry)); |
||||
return redirect()->back()->with(['msg' => 'We have recieved your enquiry. You will be contacted soon!', 'status' => true], 200); |
||||
} |
||||
|
||||
public function index() |
||||
{ |
||||
|
||||
$enquiries = Enquiry::orderBy('id', 'DESC'); |
||||
if (\request('name')) { |
||||
$key = \request('name'); |
||||
$enquiries = $enquiries->where('first_name', 'like', $key . '%'); |
||||
} |
||||
if (\request('email')) { |
||||
$key = \request('email'); |
||||
$enquiries = $enquiries->where('email', 'like', $key . '%'); |
||||
} |
||||
$enquiries = $enquiries->paginate(30); |
||||
return view('admin.enquiry.index', compact('enquiries')); |
||||
} |
||||
|
||||
public function show($id) |
||||
{ |
||||
$enquiry = Enquiry::findorfail($id); |
||||
return view('admin.enquiry.show', compact('enquiry')); |
||||
} |
||||
public function delete($id) |
||||
{ |
||||
$enquiry = Enquiry::findorfail($id); |
||||
$enquiry->delete(); |
||||
Session::flash('success', 'Enquiry has been successfully deleted!'); |
||||
return redirect('admin/enquiries'); |
||||
} |
||||
} |
@ -1,41 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Jobs; |
||||
|
||||
use App\Mail\EnquiryMail; |
||||
use App\Models\Setting; |
||||
use Illuminate\Bus\Queueable; |
||||
use Illuminate\Contracts\Queue\ShouldBeUnique; |
||||
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
use Illuminate\Foundation\Bus\Dispatchable; |
||||
use Illuminate\Queue\InteractsWithQueue; |
||||
use Illuminate\Queue\SerializesModels; |
||||
use Illuminate\Support\Facades\Mail; |
||||
|
||||
class SendEnquiryMailJob implements ShouldQueue |
||||
{ |
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||||
|
||||
/** |
||||
* Create a new job instance. |
||||
* |
||||
* @return void |
||||
*/ |
||||
protected $enquiry; |
||||
public function __construct($enquiry) |
||||
{ |
||||
$this->enquiry = $enquiry; |
||||
} |
||||
|
||||
/** |
||||
* Execute the job. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function handle() |
||||
{ |
||||
$email = Setting::where('key', 'email')->get('value')->first()->value; |
||||
|
||||
Mail::to($email)->send(new EnquiryMail($this->enquiry)); |
||||
} |
||||
} |
@ -1,65 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Mail; |
||||
|
||||
use Illuminate\Bus\Queueable; |
||||
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
use Illuminate\Mail\Mailable; |
||||
use Illuminate\Mail\Mailables\Content; |
||||
use Illuminate\Mail\Mailables\Envelope; |
||||
use Illuminate\Queue\SerializesModels; |
||||
|
||||
class EnquiryMail extends Mailable |
||||
{ |
||||
use Queueable, SerializesModels; |
||||
|
||||
/** |
||||
* Create a new message instance. |
||||
* |
||||
* @return void |
||||
* |
||||
*/ |
||||
protected $enquiry; |
||||
|
||||
public function __construct($enquiry) |
||||
{ |
||||
$this->enquiry = $enquiry; |
||||
} |
||||
|
||||
/** |
||||
* Get the message envelope. |
||||
* |
||||
* @return \Illuminate\Mail\Mailables\Envelope |
||||
*/ |
||||
public function envelope() |
||||
{ |
||||
return new Envelope( |
||||
subject: 'Enquiry Mail', |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* Get the message content definition. |
||||
* |
||||
* @return \Illuminate\Mail\Mailables\Content |
||||
*/ |
||||
public function content() |
||||
{ |
||||
return new Content( |
||||
view: 'enquiry_mail', |
||||
with: [ |
||||
'enquiry' => $this->enquiry, |
||||
], |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* Get the attachments for the message. |
||||
* |
||||
* @return array |
||||
*/ |
||||
public function attachments() |
||||
{ |
||||
return []; |
||||
} |
||||
} |
@ -1,15 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class AppointmentBookingDetail extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
public function appointment(){ |
||||
return $this->belongsTo(Appointment::class); |
||||
} |
||||
} |
@ -1,11 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Country extends Model |
||||
{ |
||||
use HasFactory; |
||||
} |
@ -1,13 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Enquiry extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $guarded = ['id']; |
||||
} |
@ -1,32 +0,0 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::table('appointments', function (Blueprint $table) { |
||||
$table->boolean('is_booked')->default(false); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::table('appointments', function (Blueprint $table) { |
||||
// |
||||
}); |
||||
} |
||||
}; |
@ -1,37 +0,0 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('appointment_booking_details', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->bigInteger('appointment_id')->unsigned(); |
||||
$table->foreign('appointment_id')->references('id')->on('appointments')->onDelete('cascade'); |
||||
$table->string('name'); |
||||
$table->string('email')->nullable(); |
||||
$table->string('phone'); |
||||
$table->string('notes')->nullable(); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('appointment_booking_details'); |
||||
} |
||||
}; |
@ -1,59 +0,0 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function up() |
||||
{ |
||||
Schema::create('enquiries', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string('first_name'); |
||||
$table->string('middle_name')->nullable(); |
||||
$table->string('last_name'); |
||||
$table->date('dob'); |
||||
$table->string('cob'); |
||||
$table->string('gender'); |
||||
$table->string('email'); |
||||
$table->string('phone'); |
||||
$table->string('address'); |
||||
$table->string('highest_qualification'); |
||||
$table->string('stream')->nullable(); |
||||
$table->string('gpa'); |
||||
$table->string('graduate_year'); |
||||
$table->string('gap')->nullable(); |
||||
$table->string('current_status')->nullable(); |
||||
$table->string('work_experience'); |
||||
$table->text('work_experience_details')->nullable(); |
||||
$table->string('salary_mode')->nullable(); |
||||
$table->string('test_score')->nullable(); |
||||
$table->string('marital_status'); |
||||
$table->string('married_date')->nullable(); |
||||
$table->string('spouse_academics')->nullable(); |
||||
$table->string('spouse_work_experience')->nullable(); |
||||
$table->string('spouse_salary_mode')->nullable(); |
||||
$table->string('immigration_history')->nullable(); |
||||
$table->string('desired_study_field')->nullable(); |
||||
$table->string('desired_location')->nullable(); |
||||
$table->boolean('status')->default(true); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function down() |
||||
{ |
||||
Schema::dropIfExists('enquiries'); |
||||
} |
||||
}; |
@ -1,49 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
use App\Models\Appointment; |
||||
use Carbon\Carbon; |
||||
use Carbon\CarbonInterval; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
|
||||
class AppointmentTableSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
* |
||||
* @return void |
||||
*/ |
||||
public function run() |
||||
{ |
||||
|
||||
$latestAppointment = DB::table('appointments')->latest('date')->first(); |
||||
$startDate = $latestAppointment ? Carbon::parse($latestAppointment->date)->addDay() : Carbon::now(); |
||||
|
||||
$startTime = Carbon::parse("9:00 AM"); |
||||
$endTime = Carbon::parse("5:00 PM"); |
||||
|
||||
foreach(config('custom.service_type') as $key => $value){ |
||||
|
||||
for ($i = 0; $i < 7; $i++) { |
||||
$date = $startDate->copy()->addDays($i); |
||||
for ($j = 0; $j <= ((($endTime->diffInMinutes($startTime)) / 30)-1); $j++) { |
||||
|
||||
$currentTime = $startTime->copy()->addMinutes(30 * $j); |
||||
$currentEndTime = $startTime->copy()->addMinutes(30 * $j + 30); |
||||
|
||||
DB::table('appointments')->insert([ |
||||
'date' => $date, |
||||
'start_time' => $currentTime->format("H:i A"), |
||||
'end_time' => $currentEndTime->format("H:i A"), |
||||
'service_type' => $key |
||||
]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
After Width: | Height: | Size: 460 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 389 KiB |
Before Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 389 KiB After Width: | Height: | Size: 389 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 394 KiB |
After Width: | Height: | Size: 394 KiB |
After Width: | Height: | Size: 2.4 MiB |
After Width: | Height: | Size: 460 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 389 KiB |
After Width: | Height: | Size: 389 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 441 KiB After Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 441 KiB After Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 500 KiB |
Before Width: | Height: | Size: 431 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 572 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 610 KiB |
Before Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 389 KiB |
After Width: | Height: | Size: 389 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 932 KiB |
Before Width: | Height: | Size: 572 KiB |
Before Width: | Height: | Size: 431 KiB |
Before Width: | Height: | Size: 405 KiB |
Before Width: | Height: | Size: 441 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 580 KiB |
Before Width: | Height: | Size: 11 KiB |