1. Go to this page and download the library: Download jumilla/laravel-versionia 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/ */
namespace App\Database\Migrations;
use Jumilla\Versionia\Laravel\Support\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class App_1_0 extends Migration
{
/**
* Migrate the database to forward.
*
* @return void
*/
public function up()
{
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('content');
$table->json('properties');
$table->timestamps();
});
}
/**
* Migrate the database to backword.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('posts');
}
}
namespace App\Providers;
use Jumilla\Versionia\Laravel\Support\DatabaseServiceProvider as ServiceProvider;
use App\Database\Migrations;
use App\Database\Seeds;
class DatabaseServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//... migration definition ...
$this->seeds([
'test' => Seeds\Test::class,
'staging' => Seeds\Staging::class,
'production' => Seeds\Production::class,
], 'test');
}
}
namespace App\Database\Seeds;
use Jumilla\Versionia\Laravel\Support\Seeder;
use Carbon\Carbon;
class Staging extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$now = Carbon::now();
app('db')->table('posts')->truncate();
app('db')->table('posts')->insert([
'title' => 'Sample post',
'content' => 'Hello laravel world.',
'properties' => json_encode([
'author' => 'Seeder',
], JSON_PRETTY_PRINT),
'created_at' => $now,
'updated_at' => $now,
]);
}
}
sh
php artisan database:status
sh
php artisan database:upgrade
sh
php artisan database:upgrade --seed <seed>
sh
php artisan database:clean
sh
php artisan database:refresh
sh
php artisan database:refresh --seed <seed>
sh
php artisan database:rollback <group>
sh
php artisan database:again <group>
sh
php artisan database:again <group> --seed <seed>
sh
php artisan database:seed <seed>
sh
php artisan database:seed
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.