mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update SeasonalController
This commit is contained in:
parent
2281727ac0
commit
090b6d0336
1 changed files with 13 additions and 12 deletions
|
@ -219,20 +219,21 @@ class SeasonalController extends Controller
|
||||||
{
|
{
|
||||||
abort_if(now()->gt('2021-03-01 00:00:00'), 404);
|
abort_if(now()->gt('2021-03-01 00:00:00'), 404);
|
||||||
abort_if(config('database.default') != 'mysql', 404);
|
abort_if(config('database.default') != 'mysql', 404);
|
||||||
$this->validate($request, [
|
|
||||||
'profile_id' => 'required',
|
|
||||||
'type' => 'required|string|in:view,hide'
|
|
||||||
]);
|
|
||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
$log = new AccountLog();
|
$log = AccountLog::firstOrCreate([
|
||||||
$log->user_id = $user->id;
|
[
|
||||||
$log->item_type = 'App\User';
|
'item_type' => 'App\User',
|
||||||
$log->item_id = $user->id;
|
'item_id' => $user->id,
|
||||||
$log->action = $request->input('type') == 'view' ? 'seasonal.my2020.view' : 'seasonal.my2020.hide';
|
'user_id' => $user->id,
|
||||||
$log->ip_address = $request->ip();
|
'action' => 'seasonal.my2020.view'
|
||||||
$log->user_agent = $request->user_agent();
|
],
|
||||||
$log->save();
|
[
|
||||||
|
'ip_address' => $request->ip(),
|
||||||
|
'user_agent' => $request->userAgent()
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
return response()->json(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue