I made a user photo exchange system, when I change the photo, I want to unlock it and try to login again, it returns me with this error:
thisismyline11:
<img src="images/uploads/avatars/{{ $user->avatar }}" alt="" class="circle responsive-img">
I made a user photo exchange system, when I change the photo, I want to unlock it and try to login again, it returns me with this error:
thisismyline11:
<img src="images/uploads/avatars/{{ $user->avatar }}" alt="" class="circle responsive-img">
This is my controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Auth;
use Image;
use Illuminate\Support\Facades\File;
class UserController extends Controller
{
public function profile(){
return view('partials.alunoform', array('user'=> Auth::user()) );
}
public function aluno(){
return view('partials.aluno', array('user'=> Auth::user()) );
}
public function update_avatar(Request $request){
// Handle the user upload of avatar
if($request->hasFile('avatar')){
$avatar = $request->file('avatar');
$filename = time() . '.' . $avatar->getClientOriginalExtension();
Image::make($avatar->getRealPath())->resize(450, 450)->save( public_path('images/uploads/avatars/' . $filename ) );
$user = Auth::user();
$user->avatar = $filename;
$user->save();
}
return view('partials.alunoform', array('user'=> Auth::user()) );
}
}
I read instead that I need to check to see if the user is logged in, how can I check this? If not, how can I resolve this error?