I got the message : Class 'App\Http\Controllers\Auth\RouteServiceProvider' not found
Class in Verify controller
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use Nexmo;
use App\Providers;
use User;
Calss in Longin Controller
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Validator;
use App\Http\Controllers\Redirect;
use App\Http\Requests;
use Nexmo;
use App\Providers;
How do you solve class problems?
Related
I have an array ($models) which has the names of my modal classes :
<?php
namespace App\Http\Controllers\systemActions;
use Storage;
use App\Accident;
use App\Company;
use App\Driver;
use App\Employee;
use App\Expert;
use App\InputTransaction;
use App\Notification;
use App\Receipt;
use App\Person;
use App\Transaction;
use App\Group;
use App\User;
use App\Permission;
use App\Witness;
use App\Companynote;
use App\RejectedReceipt;
use App\DataEntryNote;
use App\Task;
use App\Setting;
use App\RealEstate;
use App\Oldreportpayment;
use App\Freelancerdataentryaccident;
use App\UserFlow;
use App\Page;
use App\Log;
use App\Damagedetection;
use App\Datarequest;
use App\Eperson;
use App\Edriver;
use App\Eaccident;
use App\Erealestate;
use App\Subcompany;
use App\Subcompanyaccident;
use Faker\Provider\tr_TR\DateTime;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Auth;
use Hash;
use Validator;
ob_start();
session_start();
class readController extends Controller
{
$modals=['Accident','Company','Companynote','Damagedetection','Dataentrynote','Datarequest',
'Driver','Eaccident','Edriver','Eperson','Erealestate','Freelancerdataentryaccident','Garage'
,'Group','Kashef','Notification','Oldreportpayment','Person','Realestate','Receipt','Setting',
'Rejectedreceipt','Subcompany','Subcompanyaccident','Task','Transaction','Userflow','Witness'];
i was trying to use them in the following code statement :
$modals[$x]::create($DB2_Data[$x]);
but iam getting this error :
Class 'Accident' not found
on the other hand, if I put this or anything that is in the model's array, it works fine
Accident::create($DB2_Data[$x]);
so can anyone give me a solution for this problem.
so as our friend suggested up there we need to add them in the array as following : $modals=['App\Accident']
thank you
This question already has an answer here:
Class 'App\Http\Controllers\admin\Auth' not found in Laravel 5
(1 answer)
Closed 10 months ago.
I'm trying to implement Socialiate for Laravel 5.5 using this guide https://scotch.io/tutorials/laravel-social-authentication-with-socialite. Data is returned properly from the provider, but I am having trouble defining Use and Namespaces.
With this configuration:
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Socialite;
The result is:
Class 'App\Http\Controllers\Auth\User' not found
Triggered by:
$authUser = User::where('providerId', $user->id)->first();
But, if I add App\User:
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Socialite;
The result is:
Class 'App\Http\Controllers\Auth\Auth' not found
Triggered by:
Auth::login($authUser, true);
Any help is much appreciated.
You didnt import Auth namespace the right way.
The proper namespace is Illuminate\Support\Facades\Auth;
Add use Illuminate\Support\Facades\Auth; at the top of your class.
Try Also, adding use App\User;
namespace App\Http\Controllers\Auth;
use Socialite;
use App\User;
in my case help came when i see that included files were only user and not the socialproviders table in the name space i use two tables Users and Social_providers .. it took 2 days to resolve eaten 4 gb data.
enter code here
namespace App\Http\Controllers\Auth;
use Socialite;
use App\Http\Controllers\Controller;
use App\Providers\RouteServiceProvider;
use App\Models\User;
use App\Models\socialProvider;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
//use Laravel\Socialite\Facades\Socialite;
class RegisterController extends Controller
I'm trying to use the laravel 5.3 mailable for email verification, but it's not working and returns me this error -
FatalThrowableError in RegisterController.php line 84:
Class 'App\Http\Controllers\Auth\Mail' not found
The top of the RegisterController.php looks like -
namespace App\Http\Controllers\Auth;
use App\Mail\VerifyEmail;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
VerifyEmail is my mailable class generated using make:mail.
Line 82-84 of RegisterController.php -
$email = new VerifyEmail($verification_code);
Mail::to($data['email'])
->send($email);
The full stack trace is pasted here http://pastebin.com/r9sQpPdy.
Your problem is that you're trying to use the Mail facade in class that's in another namespace, without importing (use) it.
You either do:
\Mail::to($data['email'])
->send($email);
OR you should use it:
use App\Mail\VerifyEmail;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\RegistersUsers;
use Mail;
class RegisterController extends Controller
I am trying to use the inbuilt Auth for login in laravel and register. These automatically generated pages work so well, now I use Auth::guest() to check if the user is authorized to return a view: index else to login page.
But it shows:
Class 'App\Http\Controllers\Auth' not found".
Here's the code:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
class StepsController extends Controller
{
public function step1()
{
if (Auth::guest())
{
return redirect('login');
}else {
return view('index');
}
}
}
You need to "import" the definition of the facade of Auth and remove the use App\Http\Controllers\Auth because does not exists.
Just add at the top (just before the class declaration):
use Auth;
And remove the other:
Having this:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Auth;
class StepsController extends Controller
{
....
Hope it helps.
PS: If you want to learn Laravel with a good guide, step-by-step, please check here: Learn Laravel
My app structure is this:
app
-- http
-- -- controllers
-- -- -- Admin
-- -- -- -- ExampleController.php
-- ExampleModel.php
My controller:
namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class ExampleController extends Controller {
My model:
namespace App;
use Illuminate\Database\Eloquent\Model;
class ExampleModel extends Model {
My Error:
Class 'App\Http\Controllers\Admin\ExampleModel' not found
What would be the correct namespace for the following structure?
I think you should do
use App\ExampleModel;
in your controller
namespace App\Http\Controllers\Admin;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
**use App\ExampleModel;**
class ExampleController extends Controller {