public function run() { Eloquent::unguard(); DB::table('clinics')->delete(); Clinic::create(['name' => 'Apollo', 'x_coord' => '12.45', 'y_coord' => '54.23', 'address' => 'Delhi', 'email' => 'apollo', 'description' => 'apollo']); Clinic::create(['name' => 'Fortis', 'x_coord' => '56.45', 'y_coord' => '32.23', 'address' => 'Noida', 'email' => 'fortis', 'description' => 'fortis']); }
/** * Store a newly created resource in storage. * POST /clinics * * @return Response */ public function store() { $data = Input::all(); $validator = Validator::make($data, array('password' => 'min:6', 'email' => 'unique:employees', 'status' => 'required', 'clinic_name' => 'required', 'clinic_address' => 'required')); if ($validator->fails()) { return Redirect::back()->withErrors($validator)->withInput(); } $clinic = Clinic::create(['name' => $data['clinic_name'], 'address' => $data['clinic_address']]); $employee = new Employee(); $employee->clinic_id = $clinic->id; $employee->name = Input::get('name'); $employee->password = Hash::make(Input::get('password')); $employee->email = Input::get('email'); $employee->gender = Input::get('gender'); $employee->age = Input::get('age'); $employee->city = Input::get('city'); $employee->country = Input::get('country'); $employee->address = Input::get('address'); if (Input::get('phone') == '') { $employee->phone = 'N/A'; } else { $employee->phone = Input::get('phone'); } if (Input::get('cnic') == '') { $employee->cnic = 'N/A'; } else { $employee->cnic = Input::get('cnic'); } if (Input::get('branch') == '') { $employee->branch = 'N/A'; } else { $employee->branch = Input::get('branch'); } if (Input::get('note') == '') { $employee->note = 'N/A'; } else { $employee->note = Input::get('note'); } $employee->status = Input::get('status'); $employee->role = 'Administrator'; $employee->save(); $data = ['link' => URL::to('login'), 'name' => Input::get('name')]; // Send email to employee Mail::queue('emails.welcome', $data, function ($message) { $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!'); }); return Redirect::route('clinics.index'); }
public function run() { Clinic::where('id', 1)->delete(); Clinic::create(['id' => '1', 'name' => 'EMR Clinic', 'address' => 'DHA Lahore']); }