I have this problem to destroy multiple recors with model binding, I have in RouteServiceProvider.php
public function boot(Router $router)
{
parent::boot($router);
$router->model("offices","App\Office");
}
The Destroy Method is: (I'm returning $id just to check):
public function destroy($id)
{
//Office::destroy($id);
return $id;
}
My Url is sending
<form id="delete_offices" accept-charset="UTF-8" action="http://localhost/public/offices/18,19" method="POST"><input type="hidden" value="DELETE" name="_method">
<input type="hidden" value="CXnq068rEYlu88gemilBZKh6f4ZL5p7cELmZoe4B" name="_token">
<button type="submit" id="btn_delete" class="btn btn-danger">Delete</button>
</form>
But when I see what is returning in my controller, only return one object:
{"id":18,"name":"Main",,"phone":"9784773366","email":"","schedule":"Monday-friday: 8am-6pm","country_id":147,"state_id":476,"city_id":1178,"created_at":"2016-05-08 17:22:04","updated_at":"2016-05-08 17:24:57"}
What can I do to have the object with all info?, if I send ids 18 and 19 , I should get the 2 offices, the office info with id 18 and the info with id 19. If I send id 23 I should get only the info of the office with id=23.
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire