edit static pages in backend
This commit is contained in:
parent
e771c4921f
commit
783ac823ba
59 changed files with 1644 additions and 761 deletions
79
database/DisableForeignKeys.php
Normal file
79
database/DisableForeignKeys.php
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
namespace Database;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Class DisablesForeignKeys.
|
||||
*/
|
||||
trait DisableForeignKeys
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $commands = [
|
||||
'mysql' => [
|
||||
'enable' => 'SET FOREIGN_KEY_CHECKS=1;',
|
||||
'disable' => 'SET FOREIGN_KEY_CHECKS=0;',
|
||||
],
|
||||
'sqlite' => [
|
||||
'enable' => 'PRAGMA foreign_keys = ON;',
|
||||
'disable' => 'PRAGMA foreign_keys = OFF;',
|
||||
],
|
||||
'sqlsrv' => [
|
||||
'enable' => 'EXEC sp_msforeachtable @command1="print \'?\'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";',
|
||||
'disable' => 'EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";',
|
||||
],
|
||||
'pgsql' => [
|
||||
'enable' => 'SET CONSTRAINTS ALL IMMEDIATE;',
|
||||
'disable' => 'SET CONSTRAINTS ALL DEFERRED;',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Disable foreign key checks for current db driver.
|
||||
*/
|
||||
protected function disableForeignKeys()
|
||||
{
|
||||
DB::statement($this->getDisableStatement());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable foreign key checks for current db driver.
|
||||
*/
|
||||
protected function enableForeignKeys()
|
||||
{
|
||||
DB::statement($this->getEnableStatement());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current driver enable command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function getEnableStatement()
|
||||
{
|
||||
return $this->getDriverCommands()['enable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current driver disable command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function getDisableStatement()
|
||||
{
|
||||
return $this->getDriverCommands()['disable'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns command array for current db driver.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function getDriverCommands()
|
||||
{
|
||||
return $this->commands[DB::getDriverName()];
|
||||
}
|
||||
}
|
22
database/factories/PageFactory.php
Normal file
22
database/factories/PageFactory.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Access\User\User;
|
||||
use App\Models\Page;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(Page::class, function (Faker $faker) {
|
||||
$title = $faker->sentence;
|
||||
|
||||
// $newestPage = Page::orderBy('id', 'desc')->first();
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'page_slug' => str_slug($title),
|
||||
'description' => $faker->paragraph,
|
||||
'cannonical_link' => 'http://localhost/'.str_slug($title),
|
||||
'created_by' => 1,
|
||||
'status' => 1,
|
||||
'created_at' => Carbon\Carbon::now(),
|
||||
'updated_at' => Carbon\Carbon::now(),
|
||||
];
|
||||
});
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pages', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('title', 191);
|
||||
$table->string('page_slug', 191)->unique();
|
||||
$table->text('description', 65535)->nullable();
|
||||
$table->string('cannonical_link', 191)->nullable();
|
||||
$table->string('seo_title', 191)->nullable();
|
||||
$table->string('seo_keyword', 191)->nullable();
|
||||
$table->text('seo_description', 65535)->nullable();
|
||||
$table->boolean('status')->default(1);
|
||||
$table->integer('created_by')->unsigned();
|
||||
$table->integer('updated_by')->unsigned()->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pages');
|
||||
}
|
||||
}
|
|
@ -1,364 +1,345 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DatabaseSeeder extends Seeder {
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Model::unguard();
|
||||
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Model::unguard();
|
||||
|
||||
// DB::table('users')->insert([
|
||||
// DB::table('users')->insert([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => str_random(10).'@gmail.com',
|
||||
// 'password' => bcrypt('secret'),
|
||||
// ]);
|
||||
|
||||
$this->call('StudentTableSeeder');
|
||||
$this->call('CategoryTableSeeder');
|
||||
$this->call('ShelfTableSeeder');
|
||||
$this->call('BookTableSeeder');
|
||||
$this->call('PeriodeTableSeeder');
|
||||
$this->call('UserTableSeeder');
|
||||
$this->call('CollectionTableSeeder');
|
||||
$this->call('DocumentTableSeeder');
|
||||
$this->command->info('User table seeded!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UserTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('users')->insert([
|
||||
[
|
||||
'name' => "user1",
|
||||
'email' => "user1".'@gmail.com',
|
||||
'password' => bcrypt('secret')
|
||||
],
|
||||
[
|
||||
'name' => "admin",
|
||||
'email' => 'arno.kaimbacher@hotmail.de',
|
||||
'password' => bcrypt('admin007')
|
||||
]
|
||||
]);
|
||||
|
||||
$this->call('StudentTableSeeder');
|
||||
$this->call('CategoryTableSeeder');
|
||||
$this->call('ShelfTableSeeder');
|
||||
$this->call('BookTableSeeder');
|
||||
$this->call('PeriodeTableSeeder');
|
||||
$this->call('UserTableSeeder');
|
||||
$this->call('CollectionTableSeeder');
|
||||
$this->call('DocumentTableSeeder');
|
||||
$this->command->info('User table seeded!');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PeriodeTableSeeder extends Seeder {
|
||||
|
||||
class UserTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('periodes')->insert([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('users')->insert([
|
||||
[
|
||||
'name' => "user1",
|
||||
'email' => "user1" . '@gmail.com',
|
||||
'password' => bcrypt('secret'),
|
||||
],
|
||||
[
|
||||
'name' => "admin",
|
||||
'email' => 'arno.kaimbacher@hotmail.de',
|
||||
'password' => bcrypt('admin007'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class PeriodeTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('periodes')->insert([
|
||||
'id' => '1',
|
||||
'days' => '100',
|
||||
'created_at' => '2015-06-09 02:59:49',
|
||||
'updated_at' => '2015-06-10 08:14:27'
|
||||
'days' => '100',
|
||||
'created_at' => '2015-06-09 02:59:49',
|
||||
'updated_at' => '2015-06-10 08:14:27',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('categories')->insert([
|
||||
[
|
||||
// 'id' => '1',
|
||||
'category' => 'Sains',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
// 'id' => '2',
|
||||
'category' => 'Computer',
|
||||
'created_at' => '2015-06-09 01:07:41',
|
||||
'updated_at' => '2015-06-09 01:07:41',
|
||||
],
|
||||
[
|
||||
// 'id' => '3',
|
||||
'category' => 'Life Lesson',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50',
|
||||
],
|
||||
[
|
||||
// 'id' => '4',
|
||||
'category' => 'Fairy Tail',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class BookTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('books')->insert([
|
||||
[
|
||||
// 'id' => '1',
|
||||
'title' => 'Laravel 5',
|
||||
'author' => 'Arno Kaimbacher',
|
||||
'year' => '2017',
|
||||
'stock' => '9',
|
||||
'category_id' => '4',
|
||||
'shelf_id' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0',
|
||||
],
|
||||
[
|
||||
// 'id' => '2',
|
||||
'title' => 'Angular.Js',
|
||||
'author' => 'Mark Zuckerberg',
|
||||
'year' => '2014',
|
||||
'stock' => '5',
|
||||
'category_id' => '4',
|
||||
'shelf_id' => '3',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0',
|
||||
],
|
||||
[
|
||||
// 'id' => '3',
|
||||
'title' => 'OOP with PHP',
|
||||
'author' => 'Richard Stallman',
|
||||
'year' => '1999',
|
||||
'stock' => '7',
|
||||
'category_id' => '1',
|
||||
'shelf_id' => '2',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class ShelfTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('shelves')->insert([
|
||||
[
|
||||
'id' => '1',
|
||||
'shelf' => 'A',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'shelf' => 'B',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'shelf' => 'C',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'shelf' => 'D',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '5',
|
||||
'shelf' => 'E',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class StudentTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('students')->insert([
|
||||
[
|
||||
'id' => '1',
|
||||
'name' => 'Arno Kaimbacher',
|
||||
'registered_at' => '1432080000',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'name' => 'Chelsea Islan',
|
||||
'registered_at' => '1433948676',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'name' => 'John Mayer',
|
||||
'registered_at' => '1434734048',
|
||||
'borrow' => '0',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'name' => 'Emma Watson',
|
||||
'registered_at' => '1434734067',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '5',
|
||||
'name' => 'Scarlet Johansson',
|
||||
'registered_at' => '1434734082',
|
||||
'borrow' => '0',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class CollectionTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('collections')->insert([
|
||||
[
|
||||
'id' => '0',
|
||||
'number' => null,
|
||||
'name' => 'first collection',
|
||||
'parent_id' => null,
|
||||
'created_at' => new DateTime(),
|
||||
'updated_at' => new DateTime(),
|
||||
],
|
||||
[
|
||||
'id' => '1',
|
||||
'number' => '0',
|
||||
'name' => 'Informatik, Informationswissenschaft, allgemeine Werke',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'number' => '1',
|
||||
'name' => 'Philosophie und Psychologie',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:41',
|
||||
'updated_at' => '2015-06-09 01:07:41',
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'number' => '2',
|
||||
'name' => 'Religion',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50',
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'number' => '3',
|
||||
'name' => 'Sozialwissenschaften',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class DocumentTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
DB::table('documents')->insert([
|
||||
[
|
||||
'id' => '0',
|
||||
],
|
||||
[
|
||||
'id' => '1',
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CategoryTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('categories')->insert([
|
||||
[
|
||||
// 'id' => '1',
|
||||
'category' => 'Sains',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
// 'id' => '2',
|
||||
'category' => 'Computer',
|
||||
'created_at' => '2015-06-09 01:07:41',
|
||||
'updated_at' => '2015-06-09 01:07:41'
|
||||
],
|
||||
[
|
||||
// 'id' => '3',
|
||||
'category' => 'Life Lesson',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50'
|
||||
],
|
||||
[
|
||||
// 'id' => '4',
|
||||
'category' => 'Fairy Tail',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50'
|
||||
]
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class BookTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('books')->insert([
|
||||
[
|
||||
// 'id' => '1',
|
||||
'title' => 'Laravel 5',
|
||||
'author' => 'Arno Kaimbacher',
|
||||
'year' => '2017',
|
||||
'stock' => '9',
|
||||
'category_id' => '4',
|
||||
'shelf_id' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0'
|
||||
],
|
||||
[
|
||||
// 'id' => '2',
|
||||
'title' => 'Angular.Js',
|
||||
'author' => 'Mark Zuckerberg',
|
||||
'year' => '2014',
|
||||
'stock' => '5',
|
||||
'category_id' => '4',
|
||||
'shelf_id' => '3',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0'
|
||||
],
|
||||
[
|
||||
// 'id' => '3',
|
||||
'title' => 'OOP with PHP',
|
||||
'author' => 'Richard Stallman',
|
||||
'year' => '1999',
|
||||
'stock' => '7',
|
||||
'category_id' => '1',
|
||||
'shelf_id' => '2',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36',
|
||||
'year_id' => '0'
|
||||
]
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ShelfTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
||||
DB::table('shelves')->insert([
|
||||
[
|
||||
'id' => '1',
|
||||
'shelf' => 'A',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'shelf' => 'B',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'shelf' => 'C',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'shelf' => 'D',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '5',
|
||||
'shelf' => 'E',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
]
|
||||
]);
|
||||
|
||||
DB::table('link_documents_collections')->insert([
|
||||
[
|
||||
'document_id' => '0',
|
||||
'collection_id' => '1',
|
||||
],
|
||||
[
|
||||
'document_id' => '1',
|
||||
'collection_id' => '1',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
class StudentTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
||||
DB::table('students')->insert([
|
||||
[
|
||||
'id' => '1',
|
||||
'name' => 'Arno Kaimbacher',
|
||||
'registered_at' => '1432080000',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'name' => 'Chelsea Islan',
|
||||
'registered_at' => '1433948676',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'name' => 'John Mayer',
|
||||
'registered_at' => '1434734048',
|
||||
'borrow' => '0',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'name' => 'Emma Watson',
|
||||
'registered_at' => '1434734067',
|
||||
'borrow' => '1',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '5',
|
||||
'name' => 'Scarlet Johansson',
|
||||
'registered_at' => '1434734082',
|
||||
'borrow' => '0',
|
||||
'status' => '1',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class CollectionTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
// DB::table('users')->delete();
|
||||
|
||||
// User::create([
|
||||
// 'name' => str_random(10),
|
||||
// 'email' => 'foo@gmail.com',
|
||||
// 'password' => bcrypt('secret')
|
||||
// ]);
|
||||
DB::table('collections')->insert([
|
||||
[
|
||||
'id' => '0',
|
||||
'number' => null,
|
||||
'name' => 'first collection',
|
||||
'parent_id' => null,
|
||||
'created_at' => new DateTime(),
|
||||
'updated_at' => new DateTime()
|
||||
],
|
||||
[
|
||||
'id' => '1',
|
||||
'number' => '0',
|
||||
'name' => 'Informatik, Informationswissenschaft, allgemeine Werke',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 00:17:51',
|
||||
'updated_at' => '2015-06-09 01:01:36'
|
||||
],
|
||||
[
|
||||
'id' => '2',
|
||||
'number' => '1',
|
||||
'name' => 'Philosophie und Psychologie',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:41',
|
||||
'updated_at' => '2015-06-09 01:07:41'
|
||||
],
|
||||
[
|
||||
'id' => '3',
|
||||
'number' => '2',
|
||||
'name' => 'Religion',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50'
|
||||
],
|
||||
[
|
||||
'id' => '4',
|
||||
'number' => '3',
|
||||
'name' => 'Sozialwissenschaften',
|
||||
'parent_id' => '0',
|
||||
'created_at' => '2015-06-09 01:07:50',
|
||||
'updated_at' => '2015-06-09 01:07:50'
|
||||
]
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class DocumentTableSeeder extends Seeder {
|
||||
|
||||
public function run()
|
||||
{
|
||||
DB::table('documents')->insert([
|
||||
[
|
||||
'id' => '0'
|
||||
],
|
||||
[
|
||||
'id' => '1'
|
||||
]
|
||||
]);
|
||||
|
||||
DB::table('link_documents_collections')->insert([
|
||||
[
|
||||
'document_id' => '0',
|
||||
'collection_id' => '1'
|
||||
],
|
||||
[
|
||||
'document_id' => '1',
|
||||
'collection_id' => '1'
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
40
database/seeds/PagesTableSeeder.php
Normal file
40
database/seeds/PagesTableSeeder.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Database\DisableForeignKeys;
|
||||
use Database\TruncateTable;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Faker\Factory as Faker;
|
||||
|
||||
class PagesTableSeeder extends Seeder
|
||||
{
|
||||
use DisableForeignKeys;
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$faker = Faker::create();
|
||||
$title = $faker->sentence;
|
||||
|
||||
$this->disableForeignKeys();
|
||||
// $this->truncate('pages');
|
||||
$page = [
|
||||
[
|
||||
'title' => 'Terms and conditions',
|
||||
'page_slug' => 'terms-and-conditions',
|
||||
'description' => $faker->text($maxNbChars = 255),
|
||||
'status' => '1',
|
||||
'created_by' => '1',
|
||||
'created_at' => Carbon::now(),
|
||||
'updated_at' => Carbon::now(),
|
||||
],
|
||||
];
|
||||
DB::table('pages')->insert($page);
|
||||
|
||||
$this->enableForeignKeys();
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue