App\Http\Controllers\OrdersController::destroy PHP Method

destroy() public method

Remove the specified resource from storage.
public destroy ( integer $order_id, string $type ) : void
$order_id integer
$type string
return void
    public function destroy($order_id, $type)
    {
        if ($this->order->belongToUser(auth()->user(), $order_id, $order) && $this->order->canBeDeleted($type)) {
            $order->details()->delete();
            $order->delete();
            Session::push('message', trans('store.wish_list_view.success_deleting_msg'));
        } else {
            Session::push('message', trans('store.wish_list_view.error_deleting_msg'));
        }
        return redirect()->back();
    }