PHP code example of mpociot / reanimate

1. Go to this page and download the library: Download mpociot/reanimate library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mpociot / reanimate example snippets


"mpociot/reanimate": "1.*",

public function delete( User $user )
{
	$user->delete();
	return Redirect::route( "userIndex" )->with( "message", "userDeleted" );
}

public function delete( User $user )
{
	$user->delete();
	return Redirect::route( "userIndex" )->with( "message", "userDeleted" )->with( $this->undoFlash( $user ) );
}

"undo" => [
	"route"  => "userUndo",
	"params" => [ "DELETED_MODEL_ID" ],
	"lang"   => "user.undo.message"
]

namespace App\Http\Controllers;

class UserController extends Controller {
    use \Mpociot\Reanimate\ReanimateModels;
}

namespace App\Http\Controllers;

class UserController extends Controller {
    use \Mpociot\Reanimate\ReanimateModels;
    
    protected $undoDeleteModel = 'This\Is\My\Custom\Model';
    
    protected $indexRoute = 'home';
    
    protected $undoRoute = 'ohNooooo';
    
}

namespace App\Http\Controllers;

class UserController extends Controller {
    use \Mpociot\Reanimate\ReanimateModels;
    
    public function myCustomUndoMethod( $primaryKey )
    {
    	return $this->restoreModel( $primaryKey , new User(), "myCustomIndexRoute" );
    }
    
}

php composer.phar update