PHP 트레잇 Mpociot\Reanimate\ReanimateModels

Automagically manages soft-delete restores. All you need to do is use this trait inside your controller and (optionally) set the model to use for restoring When deleting the model append a new flash message to your redirect using the undoFlash method.
파일 보기 프로젝트 열기: mpociot/reanimate

공개 메소드들

메소드 설명
restoreModel ( $primary_key, $obj, $customIndexRoute = "" ) : Illuminate\Http\RedirectResponse Undo delete a model with a given primary key
undoDelete ( $primary_key ) : Illuminate\Http\RedirectResponse This is a ready-to-use route to restore models

보호된 메소드들

메소드 설명
undoFlash ( Eloquent $model, string $customUndoRoute = "" ) : array Returns the undo flash data to append to your delete redirects

비공개 메소드들

메소드 설명
getUndoModel ( ) : Eloquent Returns the Model for the undo operation If it doesn't exist it tries to generate the class name by using the calling class name stripping of "Controller" and applying str_singular So a "CategoriesController" would look for a model called "Category"

메소드 상세

restoreModel() 공개 메소드

Undo delete a model with a given primary key
public restoreModel ( $primary_key, $obj, $customIndexRoute = "" ) : Illuminate\Http\RedirectResponse
$primary_key int
$obj
리턴 Illuminate\Http\RedirectResponse

undoDelete() 공개 메소드

This is a ready-to-use route to restore models
public undoDelete ( $primary_key ) : Illuminate\Http\RedirectResponse
$primary_key
리턴 Illuminate\Http\RedirectResponse

undoFlash() 보호된 메소드

Returns the undo flash data to append to your delete redirects
protected undoFlash ( Eloquent $model, string $customUndoRoute = "" ) : array
$model Eloquent the deleted model
$customUndoRoute string
리턴 array