Initial commit to new repo

This commit is contained in:
Jonny Barnes 2016-05-19 15:01:28 +01:00
parent a267f9bfcc
commit a5173c981b
292 changed files with 17472 additions and 0 deletions

1
database/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.sqlite

View file

@ -0,0 +1,28 @@
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => bcrypt(str_random(10)),
'remember_token' => str_random(10),
];
});
$factory->define(App\Note::class, function (Faker\Generator $faker) {
return [
'note' => $faker->paragraph,
'tweet_id' => $faker->randomNumber(9),
];
});

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (! Schema::hasTable('articles')) {
Schema::create('articles', function (Blueprint $table) {
$table->increments('id');
$table->string('titleurl', 50)->unique();
$table->string('url', 120)->nullable();
$table->string('title');
$table->longText('main');
$table->tinyInteger('published')->default(0);
$table->timestamps();
$table->softDeletes();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('articles');
}
}

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (! Schema::hasTable('notes')) {
Schema::create('notes', function (Blueprint $table) {
$table->increments('id');
$table->text('note');
$table->string('in_reply_to')->nullable();
$table->string('shorturl', 20)->nullable();
$table->string('location')->nullable();
$table->tinyInteger('photo')->nullable();
$table->string('tweet_id')->nullable();
$table->string('client_id')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('notes');
}
}

View file

@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->increments('id');
$table->string('tag');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('tags');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNoteTagTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('note_tag', function (Blueprint $table) {
$table->increments('id');
$table->integer('note_id')->unsigned();
$table->integer('tag_id')->unsigned();
$table->foreign('note_id')->references('id')->on('notes');
$table->foreign('tag_id')->references('id')->on('tags');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('note_tag');
}
}

View file

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateContactsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contacts', function (Blueprint $table) {
$table->increments('id');
$table->string('nick');
$table->string('name');
$table->string('homepage')->nullable();
$table->string('twitter')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('contacts');
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateWebMentionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('webmentions', function (Blueprint $table)
{
$table->increments('id');
$table->string('source');
$table->string('target');
$table->integer('commentable_id')->nullable();
$table->string('commentable_type')->nullable();
$table->string('type')->nullable();
$table->text('content');
$table->tinyInteger('verified')->default(1);
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('webmentions');
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateClientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('clients', function (Blueprint $table) {
$table->increments('id');
$table->string('client_url');
$table->string('client_name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('clients');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->increments('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->timestamp('failed_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('failed_jobs');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediaTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('media', function (Blueprint $table) {
$table->increments('id');
$table->morphs('model');
$table->string('collection_name');
$table->string('name');
$table->string('file_name');
$table->string('disk');
$table->unsignedInteger('size');
$table->text('manipulations');
$table->text('custom_properties');
$table->unsignedInteger('order_column')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down()
{
Schema::drop('media');
}
}

View file

@ -0,0 +1,35 @@
<?php
use Phaza\LaravelPostgis\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePlacesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('places', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('slug')->unique();
$table->text('description')->nullable();
$table->point('location');
$table->polygon('polygon')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('places');
}
}

View file

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddPlaceRelationToNotes extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('notes', function (Blueprint $table) {
$table->integer('place_id')->unsigned()->nullable();
$table->foreign('place_id')->references('id')->on('places');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('notes', function (Blueprint $table) {
$table->dropForeign('notes_place_id_foreign');
$table->dropColumn('place_id');
});
}
}

1
database/seeds/.gitkeep Normal file
View file

@ -0,0 +1 @@

View file

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Seeder;
class ArticlesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('articles')->insert([
'titleurl' => 'my-new-blog',
'title' => 'My New Blog',
'main' => 'This is my new blog. It uses `Markdown`.',
'published' => 1,
'created_at' => '2016-01-12 15:51:01',
'updated_at' => '2016-01-12 15:51:01',
]);
}
}

View file

@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Seeder;
class ClientsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('clients')->insert([
'client_url' => 'https://jbl5.dev/notes/new',
'client_name' => 'JBL5',
'created_at' => '2016-01-12 16:03:00',
'updated_at' => '2016-01-12 16:03:00',
]);
}
}

View file

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Seeder;
class ContactsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('contacts')->insert([
'nick' => 'tantek',
'name' => 'Tantek Çelik',
'homepage' => 'http://tantek.com',
'twitter' => 't',
'created_at' => '2016-01-12 16:11:00',
'updated_at' => '2016-01-12 16:11:00',
]);
DB::table('contacts')->insert([
'nick' => 'aaron',
'name' => 'Aaron Parecki',
'homepage' => 'https://aaronparecki.com',
'twitter' => 'aaronpk',
'created_at' => '2016-01-12 16:12:00',
'updated_at' => '2016-01-12 16:12:00',
]);
}
}

View file

@ -0,0 +1,20 @@
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->call(ArticlesTableSeeder::class);
$this->call(ClientsTableSeeder::class);
$this->call(ContactsTableSeeder::class);
$this->call(PlacesTableSeeder::class);
$this->call(NotesTableSeeder::class);
}
}

View file

@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Seeder;
class NotesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Note::class, 10)->create();
$noteWithPlace = App\Note::create([
'note' => 'Having a #beer at the local.'
]);
$place = App\Place::find(1);
$noteWithPlace->place()->associate($place);
$noteWithPlace->save();
$noteWithContact = App\Note::create([
'note' => 'Hi @tantek'
]);
$noteWithContactPlusPic = App\Note::create([
'note' => 'Hi @aaron',
'client_id' => 'https://jbl5.dev/notes/new'
]);
$noteWithoutContact = App\Note::create([
'note' => 'Hi @bob',
'client_id' => 'https://quill.p3k.io'
]);
//copy aarons profile pic in place
$spl = new SplFileInfo(public_path() . '/assets/profile-images/aaronparecki.com');
if ($spl->isDir() === false) {
mkdir(public_path() . '/assets/profile-images/aaronparecki.com', 0755);
copy(base_path() . '/tests/aaron.png', public_path() . '/assets/profile-images/aaronparecki.com/image');
}
}
}

View file

@ -0,0 +1,23 @@
<?php
use Illuminate\Database\Seeder;
class PlacesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('places')->insert([
'name' => 'The Bridgewater Pub',
'slug' => 'the-bridgewater-pub',
'description' => 'A lovely local pub with a decent selection pf cask ales',
'location' => 'POINT(-2.3805 53.4983)',
'created_at' => '2016-01-12 16:19:00',
'updated_at' => '2016-01-12 16:19:00',
]);
}
}