3 months ago

implode(): Invalid arguments passed

Posted 3 months ago by irankhosravi

A user cannot bid on a order more than once. If the user clicks on the order again, he should be prompted with a response page noting the user of having previously bid on the order.

I create multiple checkboxes and I stored implode computer


<form action="{{ route('store') }}" method="post">
    <input type="checkbox" name="computer[]" value="1" id="hp">
    <label for="hp">HP</label>
    <input type="checkbox" name="computer[]" value="2" id="dell">
    <label for="dell">DELL</label>
    <input type="checkbox" name="computer[]" value="3" id="asus">
    <label for="asus">ASUS</label>
    <input type="checkbox" name="computer[]" value="4" id="acer">
    <label for="acer">ACER</label>
    <input type="checkbox" name="computer[]" value="5" id="sony">
    <label for="sony">Sony</label>
    <input type="checkbox" name="computer[]" value="6" id="fujitsu">
    <label for="fujitsu">Fujitsu</label>
    <input type="checkbox" name="computer[]" value="other_barnds" id="other_barnds">
    <label for="other_barnds">Other</label>
           <input type="submit" class="btn btn-primary" value="Save">


public function store(Request $request)
    $this->validate(request(), [
        'computer' => 'required'

    $order = Order::where('user_id',auth()->id())
        ->where('computer', request('computer'))
    $order = new Order($request->all());
    $order->user_id = auth()->user()->id;
    $order->description = $request->description;
    $computer = implode(",", $request->computer);
    $order->computer = $computer;

    if ($order) {
        alert()->error('Warning', 'You ordered already');
        return redirect()->back();

I get this error.

implode(): Invalid arguments passed

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