-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
backend/app/Http/Controllers/Api/PressRelease/ViewController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Api\PressRelease; | ||
|
||
use App\Exceptions\HttpJsonResponseException; | ||
use App\Http\Controllers\Controller; | ||
use App\Models\Keyword; | ||
use App\Models\User; | ||
use App\UseCases\User\FindByIdAction as UserFindByIdAction; | ||
use App\UseCases\PressRelease\FindByIdsAction; | ||
use Exception; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Auth; | ||
|
||
class ViewController extends Controller | ||
{ | ||
/** | ||
* @param Request $request | ||
* @return void | ||
* @throws Exception | ||
*/ | ||
public function __invoke(Request $request) | ||
{ | ||
/* @var User $user */ | ||
$user = UserFindByIdAction::run(Auth::id()); | ||
if ($user === null) // @todo まともにExceptionする | ||
throw new Exception("test"); | ||
|
||
$company_id = $request->get("company_id"); | ||
$release_id = $request->get("release_id"); | ||
|
||
$press_release = FindByIdsAction::run(company_id: $company_id, release_id: $release_id); | ||
|
||
if (!$press_release) | ||
throw new HttpJsonResponseException( | ||
400, | ||
"notfound", | ||
"PressRelease Not Found", | ||
compact("company_id", "release_id") | ||
); | ||
|
||
/* @var Keyword $keyword */ | ||
foreach ($press_release->keywords() as $keyword) { | ||
|
||
|
||
$user->view_histories()->create([ | ||
|
||
]); | ||
|
||
|
||
|
||
|
||
} | ||
$press_release->keywords(); | ||
|
||
|
||
$press_release->keywords(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Web; | ||
|
||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::get('/', function () { | ||
return view('welcome'); | ||
}); |