public function store()
 {
     $ext = Input::file('file')->getClientOriginalExtension();
     $user_id = Input::get('user_id');
     $validator = Validator::make(array('ext' => $ext), array('ext' => 'in:jpg,png'));
     if ($validator->fails()) {
         Session::flash('error', 'Format tidak di dukung');
         return Redirect::to('/' . Auth::user()->role . '/signature');
     } else {
         if ($ext == 'jpg') {
             $signpic = Input::file('file')->move(public_path(), 'signature_' . $user_id . '.jpg');
         } else {
             if ($ext == 'png') {
                 $signpic = Input::file('file')->move(public_path(), 'signature_' . $user_id . '.png');
             } else {
             }
         }
         $signature = new Signature();
         $signature->user_id = Input::get('user_id');
         $signature->signature_pic = '/signature_' . $user_id . '.' . $ext;
         $signature->save();
     }
     Session::flash('success', 'Data telah disimpan');
     return Redirect::to('/' . Auth::user()->role . '/signature');
 }
     } else {
         $signatureDate = "";
     }
     //if signatureID is sent then this is an update
     if (isset($_POST['signatureID']) && $_POST['signatureID'] != '') {
         $signature = new Signature(new NamedArguments(array('primaryKey' => $_POST['signatureID'])));
     } else {
         $signature = new Signature();
         $signature->signatureID = '';
     }
     $signature->signerName = $_POST['signerName'];
     $signature->signatureTypeID = $_POST['signatureTypeID'];
     $signature->documentID = $_POST['documentID'];
     $signature->signatureDate = $signatureDate;
     try {
         $signature->save();
         echo "Document Saved Successfully.";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
 case 'deleteSignature':
     $signature = new Signature(new NamedArguments(array('primaryKey' => $_GET['signatureID'])));
     try {
         $signature->delete();
         echo "Signature Deleted Successfully.";
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     break;
     //add/update expression