コード例 #1
0
 public function run()
 {
     DB::table('librarydoctypes')->delete();
     $collection = [['doctype' => 'application'], ['doctype' => 'fillable'], ['doctype' => 'flyer'], ['doctype' => 'brochure'], ['doctype' => 'leaflet'], ['doctype' => 'pamphlet'], ['doctype' => 'newsletter']];
     foreach ($collection as $record) {
         Librarydoctype::create($record);
     }
 }
コード例 #2
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Librarydoctype::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }