Skip to content
Advertisement

Blank pages after logging in or signing up on website. Laravel problem

Strange thing, I created a website with Laravel like 2 years ago and it was working just fine but now that I tried to open it and see it again, I’m facing some problems, the views work so fine before logging in or signing up to the system but ever since I sign up or log in, all pages go suddenly blank, I’m sp frustrated and I can’t figure out the problem is where exactly, also when I check my DB, a new user been added to the table users according to the infos I signed up with, so it does the work but it doesn’t show me the system.

Here’s a part of my code:

RegisterController

public function create()
{
    return view('/register');
}

public function store(Request $request)
{
    $user = new User;
    $user->name = $request->name;
    $user->email = $request->email;
    $user->password = bcrypt($request->password);

    if ($request->hasFile('photo')) {
        $user->photo = $request->photo->store('avatar');
    }

    if ($request->hasFile('image')) {
        $user->image = $request->image->store('avatar');
    }


    $user->save();

    $user->roles()->attach(Role::where('name', 'Elève')->first());

    auth()->login($user);

    return redirect('/');
}

routes

Route::get('/register', 'RegisterController@create');
Route::post('/register', 'RegisterController@store');

Does anyone have any clue? I will be so grateful if anyone shares their opinion with us. Thanks in advance!

Advertisement

Answer

Try this sort snippet of code in the user’s password field

$user->password = Hash::make($request->password);

Try

php artisan cache:clear
composer dump-autoload 

Put this on your view to see any error

@php dump($errors) @endphp

Check your network tab to see the response code that’s returned. Also, make sure you have the AppUser at the top of your controller.

Check the Laravel logs at storage/logs/laravel.log Good luck.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement