Error:
Parse error: syntax error, unexpected '$type' (T_VARIABLE), expecting ',' or ')'","exception":"Symfony\Component\Debug\Exception\FatalThrowableError","trace":[{"file":"/home/fiedel/Documents/fol/docs/develop/vendor/composer/ClassLoader.php","line":322,
These are the things included:
use App\Models\Category;
use App\Models\RegistrySession;
use Auth;
use DB;
use App\Models\Registry;
use App\Models\Project;
use App\Models\Enterprise;
use App\Models\User;
use App\Models\Group;
use League\Period\Period;
use Marcelgwerder\ApiHandler\Facades\ApiHandler;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Carbon\Carbon;
use PHPExcel;
use PHPExcel_IOFactory;
use Barryvdh\DomPDF\Facade as PDF;
use App\Models\DailyLog\CaptionDailyUser;
use App\Models\DailyLog\CaptionDailyUserProject;
use App\Models\DailyLog\UserActivityDaily;
Related
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?
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
function ClassFBLogin($d){
require_once('Facebook/autoload.php');
require_once('Facebook/FacebookSession.php');
require_once('Facebook/FacebookRedirectLoginHelper.php');
require_once('Facebook/FacebookRequest.php');
require_once('Facebook/FacebookResponse.php');
require_once('Facebook/FacebookSDKException.php');
require_once('Facebook/FacebookRequestException.php');
require_once('Facebook/FacebookAuthorizationException.php');
require_once('Facebook/GraphObject.php');
require_once('Facebook/HttpClients/FacebookCurl.php');
require_once('Facebook/HttpClients/FacebookHttpable.php');
require_once('Facebook/HttpClients/FacebookCurlHttpClient.php');
require_once('Facebook/Entities/AccessToken.php');
require_once('Facebook/GraphUser.php');
require_once('Facebook/GraphSessionInfo.php');
require_once('Facebook/HttpClients/FacebookGuzzleHttpClient.php');
require_once('Facebook/HttpClients/FacebookStream.php');
require_once('Facebook/HttpClients/FacebookStreamHttpClient.php');
use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurlHttpClient;
use Facebook\Entities\AccessToken;
use Facebook\GraphUser;
use Facebook\GraphSessionInfo;
$this->a = $data;
}
when i run this program without class it works very fine but when i put all these codes inside a class i get following error:
syntax error, unexpected 'use' (T_USE)
is there any other way of calling "use" for a class? please help.
PHP: Using namespaces: Aliasing/Importing - Manual:
Scoping rules for importing
The use keyword must be declared in the outermost scope of a file (the global scope) or inside namespace declarations. This is because the importing is done at compile time and not runtime, so it cannot be block scoped.