1Because your controller is namespaced unless you specifically import the Auth namespace, PHP will assume it's under the namespace of the class, giving this error.
2
3To fix this, add use Auth; at the top of AdminHomeController file along with your other use statements or alternatively prefix all instances of Auth with backslash like this: \Auth to let PHP know to load it from the global namespace.
1public function store()
2 {
3 $rules = array(
4 'name' => 'required',
5 );
6
7 $validator = Validator::make(Input::all(), $rules);
8
9 // if the validator fails, redirect back to the form
10 if ($validator->fails()) {
11 return Redirect::back()
12 ->withErrors($validator) // send back all errors to the login form
13 ->withInput();
14
15 $input = input::all();
16
17 } else {
18
19 $company = New Company();
20 $company->name = Input::get('name');
21 $company->user_id = Input::get('user_id');
22 $company->country_id = Input::get('country_id');
23 $company->description = Input::get('description');
24
25 $company->save();
26
27 return Redirect::to('/backend')->withInput()->with('success', Company added.');
28
29 }
30 }
31