FEATURE: add database models

This commit is contained in:
Michal Kváček
2016-01-20 20:08:39 +01:00
parent d08c7ab744
commit 2b4bc0f5f5
19 changed files with 431 additions and 34 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class ActionLog
*/
class ActionLog extends Model
{
public $timestamps = true;
protected $fillable = [
'type_id',
'user_id',
'item_id'
];
protected $guarded = [];
}
+22
View File
@@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class ActionLogType
*/
class ActionLogType extends Model
{
public $timestamps = false;
protected $fillable = [
'name'
];
protected $guarded = [];
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Content
*/
class Content extends Model
{
public $timestamps = true;
protected $fillable = [
'user_id',
'module_handler',
'title_photo',
'title',
'url',
'meta_keywords',
'meta_description',
'module_settings',
'content',
'published_from',
'published_to',
'status'
];
protected $guarded = [];
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class ContentHistory
*/
class ContentHistory extends Model
{
public $timestamps = true;
protected $fillable = [
'user_id',
'content_id',
'changed_at',
'edit_batch',
'column',
'new_value',
'old_value'
];
protected $guarded = [];
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class CustomField
*/
class CustomField extends Model
{
public $timestamps = false;
protected $fillable = [
'handler',
'name',
'description',
'default_value',
'regexp',
'min_length',
'max_length',
'required'
];
protected $guarded = [];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class CustomFieldType
*/
class CustomFieldType extends Model
{
public $timestamps = false;
protected $fillable = [
'name',
'custom_field_id'
];
protected $guarded = [];
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class File
*/
class File extends Model
{
public $timestamps = true;
protected $fillable = [
'user_id',
'filename',
'sha256_hash',
'mime_type'
];
protected $guarded = [];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Migration
*/
class Migration extends Model
{
public $timestamps = false;
protected $fillable = [
'migration',
'batch'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Module
*/
class Module extends Model
{
public $timestamps = true;
protected $fillable = [
'handler',
'name',
'description'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class ModuleHasCustomField
*/
class ModuleHasCustomField extends Model
{
public $timestamps = false;
protected $fillable = [
'module_handler',
'custom_field_id',
'value'
];
protected $guarded = [];
}
+23
View File
@@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class PasswordReset
*/
class PasswordReset extends Model
{
public $timestamps = true;
protected $fillable = [
'email',
'token'
];
protected $guarded = [];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class User
*/
class User extends Model
{
public $timestamps = false;
protected $fillable = [
'email',
'username',
'password',
'remember_token',
'name',
'status'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class UserHasCustomField
*/
class UserHasCustomField extends Model
{
public $timestamps = false;
protected $fillable = [
'user_id',
'custom_field_id',
'value'
];
protected $guarded = [];
}
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class Widget
*/
class Widget extends Model
{
public $timestamps = true;
protected $fillable = [
'widget_type_handler',
'user_id',
'name',
'settings',
'description'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class WidgetArea
*/
class WidgetArea extends Model
{
public $timestamps = true;
protected $fillable = [
'name',
'code',
'description'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class WidgetInWidgetArea
*/
class WidgetInWidgetArea extends Model
{
public $timestamps = false;
protected $fillable = [
'widget_id',
'widget_area_id',
'position'
];
protected $guarded = [];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class WidgetType
*/
class WidgetType extends Model
{
public $timestamps = false;
protected $fillable = [
'handler',
'name',
'description'
];
protected $guarded = [];
}
+4
View File
@@ -23,6 +23,10 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
if ($this->app->environment() == 'local') {
$this->app->register('Iber\Generator\ModelGeneratorProvider');
}
$this->app->register('Pingpong\Modules\ModulesServiceProvider');
}
}
@@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}