GodziLaravel's avatar

PhpStorm : Undefined class 'Validator' but it works without problem ?

Hello :

I got some warnings from phpStorm :

the first : use Validator;=> Undefined class 'Validator'

the second : where('company_id', $companyId) =>Method 'where' not found in \App\Line

Should I add something to my IDE?

use App\Line;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;



use Validator; <= HERE




use App\Http\Resources\Line as LineResources;
class LineController extends BaseController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $companyId = companyData()->id;
        $lines = Line::



        where('company_id', $companyId) <= HERE



            ->get();
        return $this->sendResponse(LineResources::collection($lines), 'Lines retrieved successfully.');
    }
0 likes
1 reply
bugsysha's avatar

Your IDE is not aware of aliases defined in the framework.

I would replace that use statement with

use Illuminate\Support\Facades\Validator;

Please or to participate in this conversation.