PHP code example of josephlavin / tap
1. Go to this page and download the library: Download josephlavin/tap 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/ */
josephlavin / tap example snippets
function createAndSaveModel($attributes)
{
$model = new Model($attributes);
$model->save();
return $model;
}
function createAndSaveModel($attributes)
{
return tap(new Model($attributes), function (Model $model) {
$model->save();
});
}
function createAndSaveModel($attributes)
{
return tap(new Model($attributes))->save();
}