本文整理匯總了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');
}