/**
  * Store a newly created resource in storage.
  * POST /clients
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Client::$rules);
     if ($validation->passes()) {
         $this->client->create($input);
         return Response::json(array('message' => 'done'));
     }
 }
Example #2
0
function doInsert()
{
    if (isset($_POST['submit'])) {
        $CLIENTNAME = $_POST['cname'];
        $CLIENTSHORTNAME = $_POST['csname'];
        $CLIENTADDRESS = $_POST['caddress'];
        $CLIENTTELEPHONE = $_POST['ctelephone'];
        $CLIENTEMAIL = $_POST['cemail'];
        $CLIENTWEBSITE = $_POST['cwebsite'];
        $CLIENTSECTOR = $_POST['csector'];
        $client = new client();
        $client->client_name = $CLIENTNAME;
        $client->client_short_name = $CLIENTSHORTNAME;
        $client->client_address = $CLIENTADDRESS;
        $client->client_telephone = $CLIENTTELEPHONE;
        $client->client_email = $CLIENTEMAIL;
        $client->client_website = $CLIENTWEBSITE;
        $client->client_sector = $CLIENTSECTOR;
    }
    if ($CLIENTNAME == "") {
        message('First name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTSHORTNAME == "") {
        message('Last Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTADDRESS == "") {
        message('Middle Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTTELEPHONE == "") {
        message('Gender Name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTEMAIL == "") {
        message('Display name is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTWEBSITE == "") {
        message('Qualification is required!', "error");
        redirect('index.php?view=add');
    } elseif ($CLIENTSECTOR == "") {
        message('Title is required!', "error");
        redirect('index.php?view=add');
    } else {
        $client->create();
        message('New client addedd successfully!', "success");
        redirect('index.php?view=list');
    }
}