我有许多车与干洗的关系。
模型干洗:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
// My root view controller is a UINavigationController
// Cast this to whatever class your root view controller is
guard let navigationController = self.window?.rootViewController as? UINavigationController else {
return false
}
// Navigate to the view controller that handles the URL within the navigation stack
navigationController.popToRootViewController(animated: false)
// Handle the URL
let vc = navigationController.topViewController as! ViewController
vc.handleDeepLink(url: url)
return true
}
并在模型车中:
public function carts()
{
return $this->belongsToMany('App\cart');
}
在视图文件中,我接受复选框值为:drycleaning_id []并输入值为q_drycleaning_id []
public function drycleanings()
{
return $this->belongsToMany('App\drycleaning');
}
我将值保存到cart_drycleaning数据库表
保存drycleaning_id,由
视图中的复选框拍摄@foreach($drycleaning as $drycleaning)
<div class="checkbox" ><label><input type="checkbox" name="drycleaning_id[]" value="{{$drycleaning->id}}">{{$drycleaning->name}}</label></div>
<input type="text" name="q_drycleaning_id[]" placeholder=" {{$drycleaning->name}} Quantity">
@endforeach
检索我用过的数据
$cart->drycleanings()->attach($request->drycleaning_id);
请帮我将q_drycleaning_id []的输入值保存到同一个表格中,即cart_drycleaning。并检索它以便查看。
提前致谢。