Basic bookmarks functionality
This commit is contained in:
parent
b840d164ed
commit
13e6ff1d0f
10 changed files with 173 additions and 0 deletions
11
database/factories/BookmarkFactory.php
Normal file
11
database/factories/BookmarkFactory.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\Bookmark::class, function (Faker $faker) {
|
||||
return [
|
||||
'url' => $faker->url,
|
||||
'name' => $faker->sentence,
|
||||
'content' => $faker->text,
|
||||
];
|
||||
});
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBookmarksTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bookmarks', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('url');
|
||||
$table->string('name')->nullable();
|
||||
$table->text('content')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bookmarks');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateBookmarkTagPivotTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('bookmark_tag', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('bookmark_id');
|
||||
$table->unsignedInteger('tag_id');
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('bookmark_id')->references('id')->on('bookmarks');
|
||||
$table->foreign('tag_id')->references('id')->on('tags');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('bookmark_tag');
|
||||
}
|
||||
}
|
16
database/seeds/BookmarksTableSeeder.php
Normal file
16
database/seeds/BookmarksTableSeeder.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class BookmarksTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
factory(App\Bookmark::class, 10)->create();
|
||||
}
|
||||
}
|
|
@ -19,5 +19,6 @@ class DatabaseSeeder extends Seeder
|
|||
$this->call(WebMentionsTableSeeder::class);
|
||||
$this->call(IndieWebUserTableSeeder::class);
|
||||
$this->call(LikesTableSeeder::class);
|
||||
$this->call(BookmarksTableSeeder::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue