예제 #1
0
 /**
  * @param $action string
  * @param $sizeId int
  * @return nothing
  * @author Tremor
  */
 public function sizeAction($action, $sizeId = 0)
 {
     if (isset($sizeId) && !empty($sizeId) && !is_numeric($sizeId)) {
         return Redirect::to('admin/size');
     }
     switch ($action) {
         case 'add':
             $size = new Size();
             $size->save();
             $newId = $size->id;
             return Redirect::to('admin/size/' . $newId);
             break;
         case 'edit':
             $post = Input::except('_token');
             $affectedRows = Size::find($sizeId)->update($post);
             return Redirect::to('admin/size/' . $sizeId);
             break;
         case 'delete':
             $size = Size::find($sizeId);
             $size->delete();
             break;
         default:
             break;
     }
     return Redirect::to('admin/size');
 }