Class 'App\Http\Controllers\Company\Validator' not found code example
Example 1: Class 'App\Http\Controllers\Validator' not found
use Illuminate\Support\Facades\Validator;
Example 2: Class 'App\Http\Controllers\Validator' not found
public function store()
{
$rules = array(
'name' => 'required',
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()
->withErrors($validator)
->withInput();
$input = input::all();
} else {
$company = New Company();
$company->name = Input::get('name');
$company->user_id = Input::get('user_id');
$company->country_id = Input::get('country_id');
$company->description = Input::get('description');
$company->save();
return Redirect::to('/backend')->withInput()->with('success', Company added.');
}
}