Advertisement
xeon9

Call to undefined method Illuminate\Validation\Validator::ma

Mar 1st, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. Controller:
  2.  
  3. <?php namespace App\Http\Controllers;
  4.  
  5. use App\Http\Requests;
  6. use App\Http\Controllers\Controller;
  7. use Illuminate\Validation\Factory;
  8. use Illuminate\Validation\Validator;
  9.  
  10. use Illuminate\Http\Request;
  11.  
  12. class UsersController extends Controller {
  13.  
  14.     /**
  15.      * Display a listing of the resource.
  16.      *
  17.      * @return Response
  18.      */
  19.     public function index()
  20.     {
  21.         return view('home');
  22.     }
  23.  
  24.     /**
  25.      * Display login page.
  26.      *
  27.      * @return Response
  28.      */
  29.     public function login()
  30.     {
  31.         return view('auth.login');
  32.     }
  33.  
  34.     /**
  35.      * Show the form for registering new member.
  36.      *
  37.      * @return Response
  38.      */
  39.     public function getCreate()
  40.     {
  41.         return view('auth.register');
  42.     }
  43.  
  44.     /**
  45.      * Show the form for creating a new resource.
  46.      *
  47.      * @return Response
  48.      */
  49.     public function postCreate()
  50.     {
  51.         //$input = Request::all();
  52.         $validator = Validator::make($request::all(),
  53.             array(
  54.                     'email'             => 'required|max:150|email|unique:users',
  55.                     'username'          => 'required|max:60|min:3|unique:users',
  56.                     'password'          => 'required|min:6',
  57.                     'password_again'    => 'required|same:password'
  58.                  )
  59.         );
  60.        
  61.         /*
  62.       $validator = Validator::make($request->all(), [
  63.             'title' => 'required|unique|max:255',
  64.             'body' => 'required',
  65.         ]);
  66.         */ 
  67.        
  68.                
  69.         if($validator->fails()) {
  70.             return 'Something wrong!';
  71.            
  72.         } else {
  73.             return 'Validation no error.';
  74.            
  75.         }
  76.     }
  77.  
  78.  
  79.     /**
  80.      * Store a newly created resource in storage.
  81.      *
  82.      * @return Response
  83.      */
  84.     public function store()
  85.     {
  86.         //
  87.     }
  88.  
  89.     /**
  90.      * Display the specified resource.
  91.      *
  92.      * @param  int  $id
  93.      * @return Response
  94.      */
  95.     public function show($id)
  96.     {
  97.         //
  98.     }
  99.  
  100.     /**
  101.      * Show the form for editing the specified resource.
  102.      *
  103.      * @param  int  $id
  104.      * @return Response
  105.      */
  106.     public function edit($id)
  107.     {
  108.         //
  109.     }
  110.  
  111.     /**
  112.      * Update the specified resource in storage.
  113.      *
  114.      * @param  int  $id
  115.      * @return Response
  116.      */
  117.     public function update($id)
  118.     {
  119.         //
  120.     }
  121.  
  122.     /**
  123.      * Remove the specified resource from storage.
  124.      *
  125.      * @param  int  $id
  126.      * @return Response
  127.      */
  128.     public function destroy($id)
  129.     {
  130.         //
  131.     }
  132.  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement