/**
  * Store a newly created update in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Update::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     Update::create($data);
     return Redirect::route('updates.index');
 }
示例#2
0
 public static function createAnswer($ticket_id, $message)
 {
     $update = new Update(array('ticket_id' => $ticket_id, 'user_id' => $_SESSION['user']['id'], 'type' => 'answer', 'message' => $message));
     $id = $update->create();
     $ticket = new Ticket(array('id' => $ticket_id));
     $ticket->setNotification();
     return $id;
 }
// get table link paramiters into input fields
if (isset($_GET) == true && empty($_GET) == false) {
    $sup_code = $_GET['sup_code'];
    $sup_name = $_GET['sup_name'];
} else {
    $sup_code = "";
    $sup_name = "";
}
$supplier = new Supplier();
$user = new User();
$x = escape($user->data()->name);
if ($user->isLoggedIn()) {
    if (Input::exists()) {
        $update = new Update();
        try {
            $update->create(array('date' => date("Y-m-d"), 'supplier_code' => Input::get('sup_code'), 'approved_kgs' => Input::get('app_kgs'), 'supplied_kgs' => Input::get('sup_kgs'), 'units' => Input::get('units'), 'editor' => $x, 'approved_by' => $x, 'last_editor' => $x, 'last_edit_date' => date("Y-m-d")));
        } catch (Exception $e) {
            die($e->getMessage());
        }
        Session::flash('success');
        Redirect::to('supply_update.php?inserted');
    }
    include 'includes/head.php';
    ?>
<body class="hold-transition skin-blue sidebar-mini">
   <div class="wrapper">
   <!-- Main Header -->
   <?php 
    include 'top_nav.php';
    ?>
   <!-- Left side column. contains the logo and sidebar -->
require_once 'core/init.php';
if (Session::exists('success')) {
    echo Session::flash('success');
}
$user = new User();
if ($user->isLoggedIn()) {
    if (Input::exists()) {
        //if(Token::check(Input::get('token'))) {
        if (true) {
            $validate = new Validation();
            $validation = $validate->check($_POST, array('sup_code' => array('required' => true), 'quantity' => array('required' => true)));
            if ($validation->passed()) {
                $update = new Update();
                try {
                    $update->create(array('sup_code' => Input::get('sup_code'), 'date' => Input::get('date'), 'quantity' => Input::get('quantity'), 'approved_kgs' => Input::get('app_kgs'), 'supplied_kgs' => Input::get('sup_kgs'), 'editor' => "no-editor-yet"));
                } catch (Exception $e) {
                    die($e->getMessage());
                }
                Session::flash('success', 'You have successfully registered.');
                Redirect::to('index.php');
            } else {
                pre($validation->errors());
            }
        }
    }
}
?>
<form action="" method="post">
    <div class="field">
        <label for="sup_code">Supplier Code: </label>
示例#5
0
                $Image->setContent($_POST["content"]);
                $Image->setTags($_POST["content"]);
                $Image->setLocation($_POST["location"]);
                $Image->setMonth($_POST["month"]);
                $Image->setDay($_POST["day"]);
                $Image->setYear($_POST["year"]);
                $Image->query($user["id"]);
                header("Location: " . htmlspecialchars($_SERVER["HTTP_REFERER"]));
            } catch (Exception $e) {
                echo $e->getMessage();
            }
        }
    } else {
        $Update = new Update($user["id"], $Database);
        try {
            echo $_POST["month"] . '-' . $_POST["day"];
            $Update->setContent($_POST["content"]);
            $Update->setTags($_POST["content"]);
            $Update->setCategory("text");
            $Update->setMonth($_POST["month"]);
            $Update->setDay($_POST["day"]);
            $Update->setYear($_POST["year"]);
            $Update->setLocation($_POST["location"]);
            $Update->setCalendarId($_POST["calendar_id"]);
            $Update->create();
            header("Location: " . htmlspecialchars($_SERVER["HTTP_REFERER"]));
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}