@ -0,0 +1,35 @@ | |||
<?php | |||
namespace App\Http\Controllers; | |||
use Illuminate\Http\Request; | |||
use DB; | |||
use App\Tweet, App\Team, App\Mission; | |||
class ShowTweetsController extends Controller | |||
{ | |||
public function mission(Mission $mission) { | |||
$tweets = Tweet::where('mission_id', $mission->id) | |||
->where('processed', 1) | |||
->where('accepted', 1) | |||
->orderBy('tweet_date', 'desc')->get(); | |||
return view('mission-tweets', [ | |||
'mission' => $mission, | |||
'tweets' => $tweets | |||
]); | |||
} | |||
public function team(Team $team) { | |||
$tweets = Tweet::where('team_id', $team->id) | |||
->where('processed', 1) | |||
->where('accepted', 1) | |||
->orderBy('tweet_date', 'desc')->get(); | |||
return view('team-tweets', [ | |||
'team' => $team, | |||
'tweets' => $tweets | |||
]); | |||
} | |||
} |
@ -0,0 +1,32 @@ | |||
<?php | |||
use Illuminate\Support\Facades\Schema; | |||
use Illuminate\Database\Schema\Blueprint; | |||
use Illuminate\Database\Migrations\Migration; | |||
class TeamSlug extends Migration | |||
{ | |||
/** | |||
* Run the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function up() | |||
{ | |||
Schema::table('teams', function (Blueprint $table) { | |||
$table->string('slug', 255); | |||
}); | |||
} | |||
/** | |||
* Reverse the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function down() | |||
{ | |||
Schema::table('teams', function (Blueprint $table) { | |||
$table->dropColumn('slug'); | |||
}); | |||
} | |||
} |
@ -0,0 +1,32 @@ | |||
<?php | |||
use Illuminate\Support\Facades\Schema; | |||
use Illuminate\Database\Schema\Blueprint; | |||
use Illuminate\Database\Migrations\Migration; | |||
class MissionSlug extends Migration | |||
{ | |||
/** | |||
* Run the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function up() | |||
{ | |||
Schema::table('missions', function (Blueprint $table) { | |||
$table->string('slug', 255); | |||
}); | |||
} | |||
/** | |||
* Reverse the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function down() | |||
{ | |||
Schema::table('missions', function (Blueprint $table) { | |||
$table->dropColumn('slug'); | |||
}); | |||
} | |||
} |
@ -0,0 +1,32 @@ | |||
<?php | |||
use Illuminate\Support\Facades\Schema; | |||
use Illuminate\Database\Schema\Blueprint; | |||
use Illuminate\Database\Migrations\Migration; | |||
class ExplicitMarkAccepted extends Migration | |||
{ | |||
/** | |||
* Run the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function up() | |||
{ | |||
Schema::table('tweets', function (Blueprint $table) { | |||
$table->boolean('accepted')->nullable(); | |||
}); | |||
} | |||
/** | |||
* Reverse the migrations. | |||
* | |||
* @return void | |||
*/ | |||
public function down() | |||
{ | |||
Schema::table('tweets', function (Blueprint $table) { | |||
$table->dropColumn('accepted'); | |||
}); | |||
} | |||
} |
@ -0,0 +1,23 @@ | |||
<div class="tweet"> | |||
<div class="profile"> | |||
<img src="{{ $tweet->player->photo }}" style="border-color: {{ '#'.$tweet->team->color }}"> | |||
<span><a href="'https://twitter.com/'+tweet.player_username">{{ '@'.$tweet->player->twitter }}</a></span> | |||
</div> | |||
<div class="text">{!! Twitter::linkify($tweet->text) !!}</div> | |||
@if($tweet->photos()) | |||
<div class="multi-photo photos-{{ count($tweet->photos()) }}"> | |||
@foreach($tweet->photos() as $photo) | |||
<div class="photo" style="background-image:url({{ $photo }})" data-featherlight="{{ $photo }}"> | |||
<img src="{{ $photo }}"> | |||
</div> | |||
@endforeach | |||
</div> | |||
<div class="multi-photo-clear"></div> | |||
@endif | |||
<a href="{{ $tweet->twitter_permalink() }}">{{ $tweet->localtime()->format('F j, g:ia') }}</a> | |||
</div> |
@ -0,0 +1,15 @@ | |||
@extends('layouts.app') | |||
@section('content') | |||
<div class="container"> | |||
<div class="row"> | |||
<div class="col-md-6 col-md-offset-3"> | |||
<h2>{{ $mission->hashtag }}</h2> | |||
@each('components.tweet', $tweets, 'tweet') | |||
</div> | |||
</div> | |||
</div> | |||
@endsection |
@ -0,0 +1,15 @@ | |||
@extends('layouts.app') | |||
@section('content') | |||
<div class="container"> | |||
<div class="row"> | |||
<div class="col-md-6 col-md-offset-3"> | |||
<h2>Team {{ $team->name }}</h2> | |||
@each('components.tweet', $tweets, 'tweet') | |||
</div> | |||
</div> | |||
</div> | |||
@endsection |