@ -0,0 +1,14 @@ | |||||
<?php | |||||
namespace App; | |||||
use Illuminate\Database\Eloquent\Model; | |||||
class Document extends Model | |||||
{ | |||||
protected $table = 'm7_documents'; | |||||
protected $fillable = [ | |||||
'name', 'description' | |||||
]; | |||||
} |
@ -0,0 +1,12 @@ | |||||
<?php | |||||
namespace App; | |||||
use Illuminate\Database\Eloquent\Model; | |||||
class TransitCenter extends Model | |||||
{ | |||||
protected $fillable = [ | |||||
'name' | |||||
]; | |||||
} |
@ -0,0 +1,12 @@ | |||||
<?php | |||||
namespace App; | |||||
use Illuminate\Database\Eloquent\Model; | |||||
class TransitLine extends Model | |||||
{ | |||||
protected $fillable = [ | |||||
'name' | |||||
]; | |||||
} |
@ -0,0 +1,66 @@ | |||||
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
class CreateTweetQueue extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create('tweets', function (Blueprint $table) { | |||||
$table->increments('id'); | |||||
$table->timestamps(); | |||||
$table->integer('player_id'); | |||||
$table->integer('team_id'); | |||||
$table->text('text'); | |||||
$table->json('photo'); | |||||
$table->datetime('claimed_at')->nullable(); | |||||
$table->boolean('processed')->default(0); | |||||
$table->integer('mission')->default(0); | |||||
// Mission 1 | |||||
$table->integer('m1_transit_line_id')->nullable(); | |||||
$table->string('m1_non_trimet', 255)->nullable(); | |||||
// Mission 2 | |||||
$table->integer('m2_transit_center_id')->nullable(); | |||||
$table->boolean('m2_with_other_team')->default(0); | |||||
// Mission 3 | |||||
$table->boolean('m3_complete')->nullable(); | |||||
// Mission 4 | |||||
$table->boolean('m4_complete')->nullable(); | |||||
// Mission 5 | |||||
$table->boolean('m5_complete')->nullable(); | |||||
$table->boolean('m5_tip')->nullable(); | |||||
// Mission 6 | |||||
$table->boolean('m6_complete')->nullable(); | |||||
// Mission 7 | |||||
$table->integer('m7_document_id')->nullable(); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('tweets'); | |||||
} | |||||
} |
@ -0,0 +1,32 @@ | |||||
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
class CreateMission7Documents extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create('m7_documents', function (Blueprint $table) { | |||||
$table->increments('id'); | |||||
$table->string('name', 255); | |||||
$table->text('description'); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('m7_documents'); | |||||
} | |||||
} |
@ -0,0 +1,31 @@ | |||||
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
class CreateMission1TransitLines extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create('transit_lines', function (Blueprint $table) { | |||||
$table->increments('id'); | |||||
$table->string('name', 255); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('transit_lines'); | |||||
} | |||||
} |
@ -0,0 +1,31 @@ | |||||
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
class CreateMission2TransitCenters extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::create('transit_centers', function (Blueprint $table) { | |||||
$table->increments('id'); | |||||
$table->string('name', 255); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::dropIfExists('transit_centers'); | |||||
} | |||||
} |
@ -0,0 +1,32 @@ | |||||
<?php | |||||
use Illuminate\Support\Facades\Schema; | |||||
use Illuminate\Database\Schema\Blueprint; | |||||
use Illuminate\Database\Migrations\Migration; | |||||
class TransitLineSortOrder extends Migration | |||||
{ | |||||
/** | |||||
* Run the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function up() | |||||
{ | |||||
Schema::table('transit_lines', function (Blueprint $table) { | |||||
$table->integer('sort')->default(0); | |||||
}); | |||||
} | |||||
/** | |||||
* Reverse the migrations. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function down() | |||||
{ | |||||
Schema::table('transit_lines', function (Blueprint $table) { | |||||
$table->dropColumn('sort'); | |||||
}); | |||||
} | |||||
} |
@ -0,0 +1,28 @@ | |||||
<?php | |||||
use Illuminate\Database\Seeder; | |||||
class DocumentSeeder extends Seeder | |||||
{ | |||||
/** | |||||
* Run the database seeds. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function run() | |||||
{ | |||||
$documents = [ | |||||
['Fare Inspection', 'Getting the fare inspected but not by a bus driver'], | |||||
['Employee Pass', 'Someone using their employer-provided pass to ride TriMet'], | |||||
['Purchase at Books with Pictures', 'A receipt for a purchase at Books with Pictures'], | |||||
['TriMet Clothing', 'A team member wearing a TriMet-branded item of clothing or gear'], | |||||
['Biketown', 'A team member holding up their Biketown card'], | |||||
['High-Five', 'A team member high-fiving a TriMet employee who is wearing official agency clothing'], | |||||
['Streetcar Dancing', 'Team members dancing on the Portland Streetcar'], | |||||
['Vintage Heavy Rail', 'Your team posing with a vintage heavy-rail train'], | |||||
['Public Art', 'Your team posing with a piece of public art'], | |||||
]; | |||||
foreach($documents as $d) | |||||
DB::table('m7_documents')->insert(['name' => $d[0], 'description' => $d[1]]); | |||||
} | |||||
} |
@ -0,0 +1,36 @@ | |||||
<?php | |||||
use Illuminate\Database\Seeder; | |||||
class TransitCenterSeeder extends Seeder | |||||
{ | |||||
/** | |||||
* Run the database seeds. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function run() | |||||
{ | |||||
// From https://trimet.org/transitcenters/index.htm | |||||
$centers = [ | |||||
'Beaverton Transit Center', | |||||
'Sunset Transit Center', | |||||
'Clackamas Town Center Transit Center', | |||||
'Gresham Central Transit Center', | |||||
'Hillsboro Central/SE 3rd Ave Transit Center', | |||||
'Willow Creek/SW 185th Ave Transit Center', | |||||
'Lake Oswego Transit Center', | |||||
'Oregon City Transit Center', | |||||
'Barbur Transit Center', | |||||
'Gateway/NE 99th Ave Transit Center', | |||||
'Hollywood/NE 42nd Ave Transit Center', | |||||
'N Lombard Transit Center', | |||||
'Parkrose/Sumner Transit Center', | |||||
'Rose Quarter Transit Center', | |||||
'Tigard Transit Center', | |||||
'Washington Square Transit Center', | |||||
]; | |||||
foreach($centers as $name) | |||||
DB::table('transit_centers')->insert(['name' => $name]); | |||||
} | |||||
} |
@ -0,0 +1,115 @@ | |||||
<?php | |||||
use Illuminate\Database\Seeder; | |||||
class TransitLineSeeder extends Seeder | |||||
{ | |||||
/** | |||||
* Run the database seeds. | |||||
* | |||||
* @return void | |||||
*/ | |||||
public function run() | |||||
{ | |||||
// From https://trimet.org/ride/stop_select_form.html | |||||
$html = '<select id="route" name="route" class="field-input field-select-input input-select"> | |||||
<option value="100">MAX Blue Line</option> | |||||
<option value="200">MAX Green Line</option> | |||||
<option value="290">MAX Orange Line</option> | |||||
<option value="90">MAX Red Line</option> | |||||
<option value="190">MAX Yellow Line</option> | |||||
<option value="203">WES Commuter Rail</option> | |||||
<option value="193">Portland Streetcar - NS Line</option> | |||||
<option value="194">Portland Streetcar - A Loop</option> | |||||
<option value="195">Portland Streetcar - B Loop</option> | |||||
<option value="208">Portland Aerial Tram</option> | |||||
<option value="1">1-Vermont</option> | |||||
<option value="4">4-Division/Fessenden</option> | |||||
<option value="6">6-Martin Luther King Jr Blvd</option> | |||||
<option value="8">8-Jackson Park/NE 15th</option> | |||||
<option value="9">9-Powell Blvd</option> | |||||
<option value="10">10-Harold St</option> | |||||
<option value="11">11-Rivergate/Marine Dr</option> | |||||
<option value="12">12-Barbur/Sandy Blvd</option> | |||||
<option value="14">14-Hawthorne</option> | |||||
<option value="15">15-Belmont/NW 23rd</option> | |||||
<option value="16">16-Front Ave/St Helens Rd</option> | |||||
<option value="17">17-Holgate/Broadway</option> | |||||
<option value="18">18-Hillside</option> | |||||
<option value="19">19-Woodstock/Glisan</option> | |||||
<option value="20">20-Burnside/Stark</option> | |||||
<option value="21">21-Sandy Blvd/223rd</option> | |||||
<option value="22">22-Parkrose</option> | |||||
<option value="23">23-San Rafael</option> | |||||
<option value="24">24-Fremont</option> | |||||
<option value="25">25-Glisan/Rockwood</option> | |||||
<option value="29">29-Lake/Webster Rd</option> | |||||
<option value="30">30-Estacada</option> | |||||
<option value="32">32-Oatfield</option> | |||||
<option value="33">33-McLoughlin/King Rd</option> | |||||
<option value="34">34-Linwood/River Rd</option> | |||||
<option value="35">35-Macadam/Greeley</option> | |||||
<option value="36">36-South Shore</option> | |||||
<option value="37">37-Lake Grove</option> | |||||
<option value="38">38-Boones Ferry Rd</option> | |||||
<option value="39">39-Lewis & Clark</option> | |||||
<option value="43">43-Taylors Ferry Rd</option> | |||||
<option value="44">44-Capitol Hwy/Mocks Crest</option> | |||||
<option value="45">45-Garden Home</option> | |||||
<option value="46">46-North Hillsboro</option> | |||||
<option value="47">47-Baseline/Evergreen</option> | |||||
<option value="48">48-Cornell</option> | |||||
<option value="50">50-Cedar Mill</option> | |||||
<option value="51">51-Vista</option> | |||||
<option value="52">52-Farmington/185th</option> | |||||
<option value="53">53-Arctic/Allen</option> | |||||
<option value="54">54-Beaverton-Hillsdale Hwy</option> | |||||
<option value="55">55-Hamilton</option> | |||||
<option value="56">56-Scholls Ferry Rd</option> | |||||
<option value="57">57-TV Hwy/Forest Grove</option> | |||||
<option value="58">58-Canyon Rd</option> | |||||
<option value="59">59-Walker/Park Way</option> | |||||
<option value="61">61-Marquam Hill/Beaverton</option> | |||||
<option value="62">62-Murray Blvd</option> | |||||
<option value="63">63-Washington Park/Arlington Hts</option> | |||||
<option value="64">64-Marquam Hill/Tigard</option> | |||||
<option value="65">65-Marquam Hill/Barbur Blvd</option> | |||||
<option value="66">66-Marquam Hill/Hollywood</option> | |||||
<option value="67">67-Bethany/158th</option> | |||||
<option value="68">68-Marquam Hill/Collins Circle</option> | |||||
<option value="70">70-12th/NE 33rd Ave</option> | |||||
<option value="71">71-60th Ave</option> | |||||
<option value="72">72-Killingsworth/82nd Ave</option> | |||||
<option value="73">73-122nd Ave</option> | |||||
<option value="75">75-Cesar Chavez/Lombard</option> | |||||
<option value="76">76-Beaverton/Tualatin</option> | |||||
<option value="77">77-Broadway/Halsey</option> | |||||
<option value="78">78-Beaverton/Lake Oswego</option> | |||||
<option value="79">79-Clackamas/Oregon City</option> | |||||
<option value="80">80-Kane/Troutdale Rd</option> | |||||
<option value="81">81-Kane/257th</option> | |||||
<option value="84">84-Powell Valley/Orient Dr</option> | |||||
<option value="85">85-Swan Island</option> | |||||
<option value="87">87-Airport Way/181st</option> | |||||
<option value="88">88-Hart/198th</option> | |||||
<option value="92">92-South Beaverton Express</option> | |||||
<option value="93">93-Tigard/Sherwood</option> | |||||
<option value="94">94-Pacific Hwy/Sherwood</option> | |||||
<option value="96">96-Tualatin/I-5</option> | |||||
<option value="97">97-Tualatin-Sherwood Rd</option> | |||||
<option value="99">99-Macadam/McLoughlin</option> | |||||
<option value="152">152-Milwaukie</option> | |||||
<option value="154">154-Willamette/Clackamas Heights</option> | |||||
<option value="155">155-Sunnyside</option> | |||||
<option value="156">156-Mather Rd</option> | |||||
<option value="291">291-Orange Night Bus</option> | |||||
</select>'; | |||||
if(preg_match_all('/"(\d+)">(.+)</', $html, $matches)) { | |||||
foreach($matches[2] as $i=>$line) { | |||||
$id = $matches[1][$i]; | |||||
DB::table('transit_lines')->insert(['id' => $id, 'name' => $line, 'sort' => $i]); | |||||
} | |||||
} | |||||
} | |||||
} |