app/Http/Controllers/StaffController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create()
    {
        $input = $request->all();
		$rules = array ('name' => 'required',
						'contactPerson' => 'required',
						'telephone' => 'required|numeric',
						'address' => 'required',);
		$message = ['name.required' => 'Please input the supplier name',
					'contactPerson.required' => 'Please input the supplier contact Person',
					'telephone.required' => 'Please input the telephone number',
					'telephone.numeric' => 'Please input the telephone number in correct format',
					'address.required' => 'Please input the address in correct format',];
		$validator = Validator::make($input, $rules, $message);
		if($validator->fails()) {
			return Redirect::to('supplier/create')->withErrors($validator);
		}else {
			$supplier = new Supplier;
			$supplier->name = $request->name;
			$supplier->contactPerson = $request->contactPerson;
			$supplier->telephone = $request->telephone;
			$supplier->address = $request->address;
			$supplier->save();
			return back()->with('Apply Supplier Information','Apply Supplier Information Sucessfully!');
		}
    }
public function create ( ) { $ input = $ request -> all ( ) ; $ rules = array ( 'name' => 'required' , 'contactPerson' => 'required' , 'telephone' => 'required|numeric' , 'address' => 'required' , ) ; $ message = [ 'name.required' => 'Please input the supplier name' , 'contactPerson.required' => 'Please input the supplier contact Person' , 'telephone.required' => 'Please input the telephone number' , 'telephone.numeric' => 'Please input the telephone number in correct format' , 'address.required' => 'Please input the address in correct format' , ] ; $ validator = Validator :: make ( $ input , $ rules , $ message ) ; if ( $ validator -> fails ( ) ) { return Redirect :: to ( 'supplier/create' ) -> withErrors ( $ validator ) ; } else { $ supplier = new Supplier ; $ supplier -> name = $ request -> name ; $ supplier -> contactPerson = $ request -> contactPerson ; $ supplier -> telephone = $ request -> telephone ; $ supplier -> address = $ request -> address ; $ supplier -> save ( ) ; return back ( ) -> with ( 'Apply Supplier Information' , 'Apply Supplier Information Sucessfully!' ) ; } }
Show the form for creating a new resource.
Show the form for creating a new resource .