mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Add UIKit model, migration and controller
This commit is contained in:
parent
591a192928
commit
fcab5010d6
3 changed files with 70 additions and 0 deletions
10
app/Http/Controllers/UIKitController.php
Normal file
10
app/Http/Controllers/UIKitController.php
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UIKitController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
21
app/UIKit.php
Normal file
21
app/UIKit.php
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
39
database/migrations/2020_04_13_045435_create_uikit_table.php
Normal file
39
database/migrations/2020_04_13_045435_create_uikit_table.php
Normal file
|
@ -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');
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue