本文整理汇总了PHP中Place::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::destroy方法的具体用法?PHP Place::destroy怎么用?PHP Place::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updatePlaces
/**
* Updates all existing places with changes provided.
*
* @return view placeManagementView
*/
public function updatePlaces()
{
$places = Place::orderBy('plc_title', 'ASC')->get();
foreach ($places as $place) {
if (Input::get('destroy' . $place->id)) {
// find all schedules that use this place and replace it with a placeholder
$filter = ClubEvent::where('plc_id', '=', $place->id)->get();
foreach ($filter as $event) {
$event->plc_id = 0;
// placeholder with plc_title "-"
$event->save();
}
Place::destroy($place->id);
} else {
// update title
$place->plc_title = Input::get('plc_title' . $place->id);
$place->save();
}
}
// need to update our index after the changes
$places = Place::orderBy('plc_title', 'ASC')->get();
return View::make('placeManagementView', compact('places'));
}
示例2: destroy
/**
* Remove the specified place from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Place::destroy($id);
return Redirect::route('places.index');
}