1. Go to this page and download the library: Download leko-team/laravel-active 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/ */
public function up(): void
{
Schema::table('your-table', function (Blueprint $table) {
$table->boolean('is_active')->default(true)->index();
$table->timestamp('start_at')->nullable()->index();
$table->timestamp('end_at')->nullable()->index();
});
}
public function down(): void
{
Schema::table('your-table', function (Blueprint $table) {
$table->dropColumn('end_at');
$table->dropColumn('start_at');
$table->dropColumn('is_active');
});
}
use ActivityTrait;
$review = Review::first();
$review->activate();
$review = Review::first();
$review->deactivate();
$review = Review::withInactive()->get();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.