Add UIKit model, migration and controller

pull/2147/head
Daniel Supernault 2020-04-26 23:28:24 -06:00
rodzic 591a192928
commit fcab5010d6
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
3 zmienionych plików z 70 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,10 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UIKitController extends Controller
{
//
}

21
app/UIKit.php 100644
Wyświetl plik

@ -0,0 +1,21 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class UIKit extends Model
{
protected $table = 'uikit';
protected $fillable = [
'k',
'v',
'defv',
'dhis'
];
public static function section($k)
{
return (new self)->where('k', $k)->first()->v;
}
}

Wyświetl plik

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateUikitTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('uikit', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('k')->unique()->index();
$table->text('v')->nullable();
$table->json('meta')->nullable();
// default value for rollbacks
$table->text('defv')->nullable();
// delta history
$table->text('dhis')->nullable();
$table->unsignedInteger('edit_count')->default(0)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('uikit');
}
}