Reformat
This commit is contained in:
parent
a2f797cbbe
commit
faf0755ebd
@ -30,6 +30,8 @@ class Ejaculation extends Model
|
||||
|
||||
public function textTags()
|
||||
{
|
||||
return implode(' ', $this->tags->map(function ($v) { return $v->name; })->all());
|
||||
return implode(' ', $this->tags->map(function ($v) {
|
||||
return $v->name;
|
||||
})->all());
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class LinkDiscovered
|
||||
{
|
||||
|
@ -10,4 +10,4 @@ class Formatter extends Facade
|
||||
{
|
||||
return \App\Utilities\Formatter::class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\User;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
@ -58,7 +58,9 @@ class RegisterController extends Controller
|
||||
$rules['g-recaptcha-response'] = 'required|captcha';
|
||||
}
|
||||
|
||||
return Validator::make($data, $rules,
|
||||
return Validator::make(
|
||||
$data,
|
||||
$rules,
|
||||
['name.regex' => 'ユーザー名には半角英数字とアンダーバー、ハイフンのみ使用できます。'],
|
||||
['name' => 'ユーザー名']
|
||||
);
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Ejaculation;
|
||||
use App\Events\LinkDiscovered;
|
||||
use App\Tag;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Validator;
|
||||
use App\Ejaculation;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Validator;
|
||||
|
||||
class EjaculationController extends Controller
|
||||
{
|
||||
@ -104,6 +104,7 @@ class EjaculationController extends Controller
|
||||
public function edit($id)
|
||||
{
|
||||
$ejaculation = Ejaculation::findOrFail($id);
|
||||
|
||||
return view('ejaculation.edit')->with(compact('ejaculation'));
|
||||
}
|
||||
|
||||
@ -166,6 +167,7 @@ class EjaculationController extends Controller
|
||||
$user = User::findOrFail($ejaculation->user_id);
|
||||
$ejaculation->tags()->detach();
|
||||
$ejaculation->delete();
|
||||
|
||||
return redirect()->route('user.profile', ['name' => $user->name])->with('status', '削除しました。');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ class InfoController extends Controller
|
||||
->orderByDesc('pinned')
|
||||
->orderByDesc('created_at')
|
||||
->paginate(20);
|
||||
|
||||
return view('info.index')->with([
|
||||
'informations' => $informations,
|
||||
'categories' => Information::CATEGORIES
|
||||
@ -23,6 +24,7 @@ class InfoController extends Controller
|
||||
public function show($id)
|
||||
{
|
||||
$information = Information::findOrFail($id);
|
||||
|
||||
return view('info.show')->with([
|
||||
'info' => $information,
|
||||
'category' => Information::CATEGORIES[$information->category]
|
||||
|
@ -38,4 +38,4 @@ class SearchController extends Controller
|
||||
|
||||
return view('search.relatedTag')->with(compact('inputs', 'results'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,8 @@ class UserController extends Controller
|
||||
}
|
||||
|
||||
// チェックインの取得
|
||||
$query = Ejaculation::select(DB::raw(<<<'SQL'
|
||||
$query = Ejaculation::select(DB::raw(
|
||||
<<<'SQL'
|
||||
id,
|
||||
ejaculated_date,
|
||||
note,
|
||||
@ -63,7 +64,8 @@ SQL
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$groupByDay = Ejaculation::select(DB::raw(<<<'SQL'
|
||||
$groupByDay = Ejaculation::select(DB::raw(
|
||||
<<<'SQL'
|
||||
to_char(ejaculated_date, 'YYYY/MM/DD') AS "date",
|
||||
count(*) AS "count"
|
||||
SQL
|
||||
@ -73,7 +75,8 @@ SQL
|
||||
->orderBy(DB::raw("to_char(ejaculated_date, 'YYYY/MM/DD')"))
|
||||
->get();
|
||||
|
||||
$groupByHour = Ejaculation::select(DB::raw(<<<'SQL'
|
||||
$groupByHour = Ejaculation::select(DB::raw(
|
||||
<<<'SQL'
|
||||
to_char(ejaculated_date, 'HH24') AS "hour",
|
||||
count(*) AS "count"
|
||||
SQL
|
||||
@ -133,7 +136,8 @@ SQL
|
||||
}
|
||||
|
||||
// チェックインの取得
|
||||
$query = Ejaculation::select(DB::raw(<<<'SQL'
|
||||
$query = Ejaculation::select(DB::raw(
|
||||
<<<'SQL'
|
||||
id,
|
||||
ejaculated_date,
|
||||
note,
|
||||
|
@ -58,4 +58,4 @@ SQL
|
||||
|
||||
$view->with(compact('latestEjaculation', 'currentSession', 'summary'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ use App\Metadata;
|
||||
use App\MetadataResolver\MetadataResolver;
|
||||
use App\Utilities\Formatter;
|
||||
use GuzzleHttp\Exception\TransferException;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LinkCollector
|
||||
|
@ -12,9 +12,10 @@ class DLsiteResolver implements Resolver
|
||||
$ogpResolver = new OGPResolver();
|
||||
$metadata = $ogpResolver->parse($res->getBody());
|
||||
$metadata->image = str_replace("img_sam.jpg", "img_main.jpg", $metadata->image);
|
||||
|
||||
return $metadata;
|
||||
} else {
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class FantiaResolver implements Resolver
|
||||
$ogpUrl = $node->getAttribute('content');
|
||||
|
||||
// 投稿に画像がない場合(ogp.jpgでない場合)のみ大きい画像に変換する
|
||||
if($ogpUrl != "http://fantia.jp/images/ogp.jpg"){
|
||||
if ($ogpUrl != "http://fantia.jp/images/ogp.jpg") {
|
||||
preg_match("~https://fantia\.s3\.amazonaws\.com/uploads/post/file/{$postId}/ogp_(.*?)\.(jpg|png)~", $ogpUrl, $match);
|
||||
$uuid = $match[1];
|
||||
$extension = $match[2];
|
||||
|
@ -54,4 +54,4 @@ class IwaraResolver implements Resolver
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,4 +27,4 @@ class KomifloResolver implements Resolver
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,4 +26,4 @@ class MelonbooksResolver implements Resolver
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,4 +7,4 @@ class Metadata
|
||||
public $title = '';
|
||||
public $description = '';
|
||||
public $image = '';
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,12 @@ class MetadataResolver implements Resolver
|
||||
{
|
||||
foreach ($this->rules as $pattern => $class) {
|
||||
if (preg_match($pattern, $url) === 1) {
|
||||
$resolver = new $class;
|
||||
$resolver = new $class();
|
||||
|
||||
return $resolver->resolve($url);
|
||||
}
|
||||
}
|
||||
|
||||
throw new \UnexpectedValueException('URL not matched.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,4 +21,4 @@ class NicoSeigaResolver implements Resolver
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,4 +37,4 @@ class NijieResolver implements Resolver
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ class OGPResolver implements Resolver
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,17 +4,17 @@ namespace App\MetadataResolver;
|
||||
|
||||
class PixivResolver implements Resolver
|
||||
{
|
||||
|
||||
/**
|
||||
* サムネイル画像 URL から最大長辺 1200px の画像 URL に変換する
|
||||
*
|
||||
* @param string $thumbnailUrl サムネイル画像 URL
|
||||
* @return string 1200px の画像 URL
|
||||
*/
|
||||
public function thumbnailToMasterUrl(string $thumbnailUrl):string
|
||||
public function thumbnailToMasterUrl(string $thumbnailUrl): string
|
||||
{
|
||||
$temp = str_replace("/c/128x128", "", $thumbnailUrl);
|
||||
$largeUrl = str_replace("square1200.jpg", "master1200.jpg", $temp);
|
||||
|
||||
return $largeUrl;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ class PixivResolver implements Resolver
|
||||
* @param string $pixivUrl i.pximg URL
|
||||
* @return string i.pixiv.cat URL
|
||||
*/
|
||||
public function proxize(string $pixivUrl):string
|
||||
public function proxize(string $pixivUrl): string
|
||||
{
|
||||
return str_replace("i.pximg.net", "i.pixiv.cat", $pixivUrl);
|
||||
}
|
||||
|
@ -5,4 +5,4 @@ namespace App\MetadataResolver;
|
||||
interface Resolver
|
||||
{
|
||||
public function resolve(string $url): Metadata;
|
||||
}
|
||||
}
|
||||
|
@ -14,9 +14,10 @@ class ToranoanaResolver implements Resolver
|
||||
$res = $client->get($url, ['cookies' => $cookieJar]);
|
||||
if ($res->getStatusCode() === 200) {
|
||||
$ogpResolver = new OGPResolver();
|
||||
|
||||
return $ogpResolver->parse($res->getBody());
|
||||
} else {
|
||||
throw new \RuntimeException("{$res->getStatusCode()}: $url");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
@ -2,8 +2,8 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class User extends Authenticatable
|
||||
@ -36,9 +36,10 @@ class User extends Authenticatable
|
||||
* @param int $size 画像サイズ
|
||||
* @return string Gravatar 画像URL
|
||||
*/
|
||||
public function getProfileImageUrl($size = 30) : string
|
||||
public function getProfileImageUrl($size = 30): string
|
||||
{
|
||||
$hash = md5(strtolower(trim($this->email)));
|
||||
|
||||
return '//www.gravatar.com/avatar/' . $hash . '?s=' . $size;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ class Formatter
|
||||
$days = floor($value / 86400);
|
||||
$hours = floor($value % 86400 / 3600);
|
||||
$minutes = floor($value % 3600 / 60);
|
||||
|
||||
return "{$days}日 {$hours}時間 {$minutes}分";
|
||||
}
|
||||
|
||||
@ -61,4 +62,4 @@ class Formatter
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEjaculationsTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateInformationTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddLinkToEjaculations extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTagsTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMetadataTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class RecreateMetadataTable extends Migration
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class ChangeLinkOnEjaculations extends Migration
|
||||
{
|
||||
|
@ -121,4 +121,4 @@ return [
|
||||
'password' => 'パスワード',
|
||||
],
|
||||
|
||||
];
|
||||
];
|
||||
|
@ -40,5 +40,6 @@ Route::get('/checkin/card', function (Request $request, MetadataResolver $resolv
|
||||
if (!config('app.debug')) {
|
||||
$response = $response->setCache(['public' => true, 'max_age' => 86400]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ Auth::routes();
|
||||
|
||||
Route::get('/', 'HomeController@index')->name('home');
|
||||
|
||||
Route::get('/user', function() {
|
||||
Route::get('/user', function () {
|
||||
return redirect()->route('user.profile', ['name' => Auth::user()->name]);
|
||||
})->middleware('auth')->name('user.profile');
|
||||
Route::get('/user/{name?}', 'UserController@profile')->name('user.profile');
|
||||
@ -36,4 +36,4 @@ Route::get('/info/{id}', 'InfoController@show')->where('id', '[0-9]+')->name('in
|
||||
|
||||
Route::redirect('/search', '/search/checkin', 301);
|
||||
Route::get('/search/checkin', 'SearchController@index')->name('search');
|
||||
Route::get('/search/related-tag', 'SearchController@relatedTag')->name('search.related-tag');
|
||||
Route::get('/search/related-tag', 'SearchController@relatedTag')->name('search.related-tag');
|
||||
|
@ -2,10 +2,10 @@
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Tests\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user