Support the ongoing development of Laravel.io →
Authentication Views Forms

hi guys i have no error and log my problem is when i click submit it give me this url http://localhost/directories/public/users/createuser blank page it doesnt redirect or view to http://localhost/directories/public/users when i register someone help me pls thanks :)

Route:


<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

Route::get('users/verify/{confirmationCode}',[
	'as' => 'confirm', 'uses' => 'userRegistrationController@confirm'
]);
Route::get('/', 'mainController@index');
Route::get('contact', 'mainController@contact');


Route::get('home', 'HomeController@index');
Route::controller('admin','adminController');
Route::controller('menu','mainController');
Route::controller('users','userController');
Route::controller('advertiser','advertiserController');



Route::controllers([
	'auth' => 'Auth\AuthController',
	'password' => 'Auth\PasswordController',
]);

Controller


<?php namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Shop;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Mail;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Facades\Redirect;

class userController extends Controller {


    public function __construct () {
        $this->middleware('confirm',['only'=>'postLogin']);
        $this->beforeFilter('csrf', array('on' => 'post'));



    }

    public function getIndex () {

        return Redirect::to('users.index')->with([
            'message' => 'Thanks for signing up! Please check your email']);;

    }

    public function postCreateuser(Request $request) {





        $this->validate($request,['username' => 'required|email',
            'password' => 'required|min:8',
            'confirm_password' => 'required|same:password|min:8'
        ]);

            $confirmation_code = str_random(30);

            $users = new User;
        $users->name = Input::get('name');
        $users->username = Input::get('username');
        $users->password = Hash::make(Input::get('password'));
        $users->user_level = 0;
        $users->confirmation_code = $confirmation_code;
        $users->save();

        Mail::send('emails.verify',  array('confirmation_code' => $confirmation_code), function($message) {
            $message->to(Input::get('username'),"carlo")
                ->subject('Verify your email address');

            return view('users.index')->with([
                'message' => 'Thanks for signing up! Please check your email']);

        });


    }


    public function postCreateadvertiser(Request $request) {

        if (User::where('username', '=', Input::get('username'))->exists()) {

            return View('users.index');

        }
        $this->validate($request,[
            'username' => 'required|email',
            'password' => 'required|min:8',
            'confirm_password' => 'required|same:password|min:8',
            'website_name' => 'required',
            'website_url' => 'required',
            'category' => 'required',
            'type' => 'required',
            'sells' => 'required',
            'location' => 'required',
            'description' => 'required',
            'payment' => 'required',
            'image'=>'required|image|mimes:jpeg,jpg,bmp,png,gif'


        ]);
        $confirmation_code = str_random(30);
        Mail::send('emails.verify',  array('confirmation_code' => $confirmation_code), function($message) {
            $message->to(Input::get('username'),"carlo")
                ->subject('Verify your email address');


            $confirmation_code = str_random(30);
            $users = new User;
            $users->username = Input::get('username');
            $users->password = Hash::make(Input::get('password'));
            $users->user_level = 1;
            $users->confirmation_code = $confirmation_code;
            $users->save();





            $shops = new Shop;
            $shops->website_name = Input::get('website_name');
            $shops->website_url = Input::get('website_url');
            $shops->category = Input::get('category');
            $shops->type = Input::get('type');
            $shops->description = Input::get('description');
            $shops->sells = Input::get('sells');
            $shops->location = Input::get('location');
            $shops->payment = Input::get('payment');
            $shops->username = Input::get('username');
            $image = Input::file('image');
            $filename  = time() . '.' . $image->getClientOriginalExtension();
            $path = public_path('img/shop_image/' . $filename);
            Image::make($image->getRealPath())->resize(468, 249)->save($path);
            $shops->image = 'img/shop_image/'.$filename;
            $shops->save();



            return Redirect::to('users/idnex')
                ->with('message', 'Thank you for creating a new account. Please sign in');
        });







    }




    public function confirm($confirmation_code)
    {
        if( ! $confirmation_code)
        {
            throw new InvalidConfirmationCodeException;
        }

        $user = User::whereConfirmationCode($confirmation_code)->first();

        if ( ! $user)
        {
            throw new InvalidConfirmationCodeException;
        }

        $user->confirmed = 1;
        $user->confirmation_code = null;
        $user->save();


        return Redirect::to('users/index')->with([
            'message' => 'You have successfully verified your account.',]);;

    }




    public function postLogin() {

            if (Auth::attempt(array('username'=>Input::get('username'), 'password'=>Input::get('password')))) {
            return Redirect::to('advertiser/index')->with('message', 'Thanks for signing in');

                }


        return Redirect::to('users/index')->with('message', 'Your email/password combo was incorrect');
    }




    public function getSignout() {


        Auth::logout();
        Session::flush();
        return Redirect::to('users/signin')->with('message', 'You have been signed out');
    }


}

View


 <div class="modal fade" id="userregistration" tabindex="-1" role="dialog" aria-labelledby="modalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">X</span><span class="sr-only"></span></button>
                    <h3 class="modal-title" id="lineModalLabel">Shop Registration</h3>
                </div>
                <div class="modal-body">

                    {!! Form::Open(['url' => 'users/createuser'] ) !!}
                    <div class="form-group col-lg-12">
                        <label>Full Name</label>
                        <input type="textbox" name="name" class="form-control" id="" >
                    </div>
                        <div class="form-group col-lg-12">
                            <label>Email</label>
                            <input type="textbox" name="username" class="form-control" id="" >
                        </div>
                        <div class="form-group col-lg-12">
                            <label>Password</label>
                            <input type="password" name="password" class="form-control" id="" value="">
                        </div>

                    <div class="form-group col-lg-12">
                        <label>Confirm Password</label>
                        <input type="password" name="confirm_password" class="form-control" id="" value="">
                    </div>



                    <input type="submit" value="Register" class="btn btn-primary btn-block btn-lg" style="width: 100%;" tabindex="7">

                    {!! Form::close() !!}


                </div>

            </div>

        </div>

    </div>

Last updated 2 years ago.
0
return view('users.index')->with([
            'message' => 'Thanks for signing up! Please check your email']);

This line is inside of a closure (so inside of a function), the return statement therefore would return the function. But that function is not your controller method, so the controller method (postCreateuser) doesn't return the necessary response object (the one that you create with view()).

0

Sign in to participate in this thread!

Eventy

Your banner here too?

lycans28 lycans28 Joined 24 May 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.