M
M
MrChen2016-06-28 16:39:24
Laravel
MrChen, 2016-06-28 16:39:24

Why can't render template from laravel controller?

Hello! I need to render a template from a laravel controller. It seems that everything is working correctly, but the controller simply does not render the page, no error pops up! Just a blank page. Such a page exists in a folder and is rendered if called. Here is the controller code:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;

use Illuminate\Support\Facades\Redirect;

use DB;

class UserController extends Controller
{
  public function index_reg(Request $request) {
    if($this->check()) {
      
    } else {
      $this->validation($request);
    }
  }

    public function user_reg(Request $request) {

    }

    public function check() {
    	if(isset($_COOKIE['remember_token']) && $_COOKIE['remember_token'] != null) {
    		return true;
    	} else {
    		return false;
    	}
    }

    public function validation(Request $request) {
    	$login = $request->input('login');
 		$email = $request->input('email');
 		$password = $request->input('password');
 		$r_password = $request->input('r_password');
 		$about = $request->input('about_me');

 		$text_error = '';
 		$errors = false;

 		$users = DB::table('users')->where('login', $login)->orwhere('email', $email)->count();

 		if ($users > 0) {
 			$text_error = 'Пользователь с таким логином или Email уже зарегистрирован.';
 			$errors = true;
 		} else {
 			if (strlen($login) < 6 OR strlen($login) > 10) {
 				$text_error = 'Длина логина должна быть не менее 6 символов и не больше 10.';
 				$errors = true;
   		} else {
   			if ($r_password != $password) {
   				$text_error = 'Пароли должны совпадать совпадают.';
   				$errors = true;
   			} else {
   				if (strlen($password) < 6 OR strlen($password) > 10) {
   	 				$text_error = 'Длина пароля должна быть не менее 6 символов и не больше 10.';
 						$errors = true;				
   				} else {
   					$this->user_reg($request);
   				}
   			}
   		}
 		}

 		if ($errors) {
      return view('Main')->with('text_error', 'Victoria');	
 		}
    }
}

All code comes up to this point:
if ($errors) {
      return view('Main')->with('text_error', 'Victoria');	
 		}

And then a clean slate. Please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
neol, 2016-06-28
@MrChen

https://laravel.com/docs/5.1/validation
I'll just leave this here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question