0

Here is my simple Controller:

public function addProduct(Request $request)
{
    $product = new Product;    
    $product->product_name = $request->product;    

    return $product->save();    
    return back();
}

When it is processed product_name is saved to products table, but I receive the following error as well:

UnexpectedValueException in Response.php line 393: The Response content must be a string or object implementing __toString(), "boolean" given.

1
  • 2
    change return $product->save(); to $product->save(); Commented Aug 10, 2016 at 21:05

1 Answer 1

2

Why do you try to return value of $product->save(); call? If you want to save entry and return back then simply

$product->save();
return back();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.