/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $name = Input::get('name'); $address = Input::get('address'); $amount_required = Input::get('amount_required'); $amount_gathered = 0; $description = Input::get('description'); $path = ""; if (Input::file('picture') != null && Input::file('picture')->isValid()) { $destinationPath = 'uploads'; $extension = Input::file('picture')->getClientOriginalExtension(); $fileName = rand(11111, 99999) . '.' . $extension; Input::file('picture')->move($destinationPath, $fileName); $path = $destinationPath . "/" . $fileName; } $image = new Image(); $image->path = $path; $image->save(); $school = new School(); $school->name = $name; $school->user_id = Auth::user()->user_id; $school->address = $address; $school->amount_required = $amount_required; $school->amount_gathered = 0; $school->description = $description; $school->image_id = $image->image_id; $school->save(); return view('new_listing')->with('message', 'Successfully added'); }
public function store() { $school = new School(); $school->name = Input::get('name'); $school->kana = Input::get('kana'); $school->save(); }
public function postAdd(Request $request) { $rules = ['school' => 'required']; $input = Input::only('school'); $validator = Validator::make($input, $rules); if ($validator->fails()) { return Redirect::back()->withInput()->withErrors($validator); } $school = new School(); $school->school_name = $request->school; $school->save(); $schools = School::all(); return redirect()->route('schools')->with('schools', $schools); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('schools')->truncate(); $school = new School(); $school->name = ''; $school->logo = ''; $school->phone = ''; $school->email = ''; $school->swift_code = ''; $school->line1 = ''; $school->line2 = ''; $school->line3 = ''; $school->bank_id = 0; $school->account_name = ''; $school->account_number = ''; $school->promotion_avg = 0.0; $school->parent_discount = ''; $school->staff_discount = ''; $school->save(); }
public function store(Request $request, $id = null) { $validator = Validator::make($request->all(), $this->school->rules); if ($validator->passes()) { if (isset($id)) { $school = $this->school->find($id); } else { $school = new School(); } $school->school_name = $request->input('school_name'); $school->contact_name = $request->input('contact_name'); $school->phone = $request->input('phone'); $school->email = $request->input('email'); $school->website = $request->input('website'); $school->application_url = $request->input('application_url'); $school->save(); return redirect()->to('schools')->with(['success' => 'School <span class="mono">' . $school->school_name . '</span> saved']); } else { return redirect()->back()->withInput()->withErrors($validator->messages()); } }
/** * Run the database seeds. * * @return void */ public function run() { // remove any data from the table first School::truncate(); // create 5 school objects $school1 = new School(); $school1->schoolname = 'Wantirna'; $school1->save(); $school2 = new School(); $school2->schoolname = 'Bayswater'; $school2->save(); $school3 = new School(); $school3->schoolname = 'Scoresby'; $school3->save(); $school4 = new School(); $school4->schoolname = 'Vermont'; $school4->save(); $school5 = new School(); $school5->schoolname = 'Boronia'; $school5->save(); }
/** * Execute the console command. * * @return mixed */ public function handle() { // grab all School $schools = DB::table('School')->get(); // migrate foreach ($schools as $school) { $new = new School(); $new->region = $school->Region; $new->name = $school->SchoolName; $new->address = $school->Address; $new->city = $school->City; $new->state = $school->State; $new->zip = $school->Zip; $new->phone = $school->Phone; $new->votes = $school->Votes; $new->balance = $school->pastDue; if ($school->date) { $new->joined_at = new \Carbon\Carbon($school->date, 'America/New_York'); } else { $new->joined_at = new \Carbon\Carbon('January 1 2014', 'America/New_York'); } $new->save(); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); $school = new \App\School(); $school->name = "Royal College"; $school->city = "Colombo 07"; $school->district = "Colombo"; $school->in_quota = 200; $school->comes_in = true; $school->goes_out = false; $school->cutoff_mark = 175; $school->save(); $school = new \App\School(); $school->name = "Ananda College"; $school->city = "Colombo 10"; $school->district = "Colombo"; $school->in_quota = 150; $school->comes_in = true; $school->goes_out = false; $school->cutoff_mark = 170; $school->save(); $school = new \App\School(); $school->name = "Maliyadeva College"; $school->city = "Kurunegala"; $school->district = "Kurunegala"; $school->in_quota = 100; $school->comes_in = true; $school->goes_out = true; $school->cutoff_mark = 168; $school->save(); $school = new \App\School(); $school->name = "Dharmaraja College"; $school->city = "Kandy"; $school->district = "Kandy"; $school->in_quota = 150; $school->comes_in = true; $school->goes_out = false; $school->cutoff_mark = 172; $school->save(); $school = new \App\School(); $school->name = "Nalanda College"; $school->city = "Colombo 10"; $school->district = "Colombo"; $school->in_quota = 100; $school->comes_in = true; $school->goes_out = false; $school->cutoff_mark = 168; $school->save(); $school = new \App\School(); $school->name = "Mahanama College"; $school->city = "Colombo 03"; $school->district = "Colombo"; $school->in_quota = 50; $school->comes_in = true; $school->goes_out = true; $school->cutoff_mark = 160; $school->save(); $school = new \App\School(); $school->name = "Bandaranayake College"; $school->city = "Gampaha"; $school->district = "Gampaha"; $school->in_quota = 50; $school->comes_in = true; $school->goes_out = true; $school->cutoff_mark = 160; $school->save(); $school = new \App\School(); $school->name = "Horagasmulla Primary School"; $school->city = "Divulapitiya"; $school->district = "Gampaha"; $school->in_quota = 0; $school->comes_in = false; $school->goes_out = true; $school->cutoff_mark = 0; $school->save(); $school = new \App\School(); $school->name = "Balagalla Primary School"; $school->city = "Divulapitiya"; $school->district = "Gampaha"; $school->in_quota = 0; $school->comes_in = false; $school->goes_out = true; $school->cutoff_mark = 0; $school->save(); $school = new \App\School(); $school->name = "Hunumulla Central College"; $school->city = "Hunumulla"; $school->district = "Gampaha"; $school->in_quota = 20; $school->comes_in = true; $school->goes_out = true; $school->cutoff_mark = 136; $school->save(); $names = array('Nipun Perera', 'Imesha Sudasingha', 'Madhawa Vidanapathirana', 'Jayan Chathuranga', 'Pasindu Kanchana', 'Dulaj Atapattu'); for ($i = 0; $i < 20; $i++) { $student = new \App\Student(); $student->name = $names[rand(0, count($names) - 1)]; $student->examination_no = rand(1000000, 9999999); $student->results = rand(100, 200); $student->password = \Illuminate\Support\Facades\Hash::make("1234"); $student->school_id = rand(1, 10); $student->save(); $studentexam = new \App\ExamResultsRest(); $studentexam->name = $student->name; $studentexam->examination_number = $student->examination_no; $studentexam->dob = "1993-05-01"; $studentexam->district = "Colombo"; $studentexam->marks = rand(50, 200); $studentexam->school = School::find($student->school_id)->name; $studentexam->save(); } Model::reguard(); }