Nosean
1 year ago

Update Validation

Posted 1 year ago by Nosean

Hey Guys,

i have a question about update validation:

My Code:

´´´ public function update(Article $article) {

    $data = $this->validate(request(), [
        'article_name' => 'required',
        'article_description' => 'required|max:255',
        'article_number' => 'required',
        'article_nettoprice' => array([
            'required',
            'regex:/^[0-9]{1,3}(,[0-9]{3})*(\.[0-9]+)*$/']),
        'article_tax_id' => 'required',
        'article_bruttoprice' => 'numeric|between:0.00, 999999.99',
        'article_unit_id' => 'required',
        'article_selfprice' => 'numeric|between:0.00, 999999.99'

    ]);


    $article->update(request()->except('_token'));
    Session::flash('message', 'Artikel erfolgreich aktualisiert');
    return back();
}

´´´

When I pass an invalid number of article_nettorprice (80,011ll) I get the following SQL error message:

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'article_nettoprice' at row 1 (SQL: update articles set article_nettoprice = 80.04gg, updated_at = 2018-08-19 08:21:31 where id = 6)

Ok my question:

why I will not be back in the validation on the previous page with the note net price wrong.

Thank you

Please sign in or create an account to participate in this conversation.