In my model i have a method
public function newUserUpload(string $save_path){
$this->photo_moderation_src = $save_path;
if(Auth::check()){
$this->user_id = Auth::id();
}
$this->save();
return null;
}
After authorization i try to upload file but the record in the database is created without user_id. At the same time the authorization check in my blade is working correctly.
@if (!Auth::check())
<li><a href="/home">Auth</a></li>
@else
<li><a href="/logout/">Exit</a></li>
@endif
Could this be due to the fact that I use vueJs + Laravel api routes?
Route::middleware('api')->group(function(){
Route::post('/upload/', 'CompgenApiController@userUpload');
Route::post('/reupload/', 'CompgenApiController@moderationReupload');
});