PHP code example of dillingham / soft-deletes-parent
1. Go to this page and download the library: Download dillingham/soft-deletes-parent 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/ */
dillingham / soft-deletes-parent example snippets
Schema::table('posts', function (Blueprint $table) {
$table->softDeletesParent();
});
namespace App\Models;
use Dillingham\SoftDeletesParent\SoftDeletesParent;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use SoftDeletesParent;
}
namespace App\Providers;
class AppServiceProvider
{
public function register()
{
Post::softDeletesParent(Author::class);
}
}
Post::withParentTrashed()->get();
Post::onlyParentTrashed()->get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.