T
T
Twelfth Doctor2017-05-05 17:23:32
Laravel
Twelfth Doctor, 2017-05-05 17:23:32

Why is the class not in Lavarel?

Hello! Can you tell me why this file is throwing an error Class 'app\Http\Controllers\Controller' not found

<?php


namespace App;

use DB;
use app\Http\Controllers\Controller;

class Site extends Controller
{
    function __construct($domainid , $userid , $vhostid)
    {
        $this->domainid = $domainid;
        $this->userid = $userid;
        $this->vhostid = $vhostid;
    }

    /**
     *
     *
     * @return Response
     */
    private function checkbelong ($domainid, $userid , $vhostid)
    {
        $checkdom = DB::table("domain")
            ->select('unid')
            ->where("userid",  $userid)
            ->where ("unid" , $domainid)
            ->where("type" , "unlinked")
        ->get();
        $checkvh = DB::table("vhosts")
            ->select('unid')
            ->where("userid",  $userid)
            ->where ("unid" , $vhostid)
            ->get();
        var_dump($checkvh);
if (!$checkvh OR !$checkdom) {return $error = "Trying to link foreign domain";}
else {return true;}
    }
    private function checkexist ($domainid,$vhostid) {
        $checkdom = DB::table("domain")
        ->select('unid')
        ->where ("unid" , $domainid)
        ->where("type" , "unlinked")
        ->get();
        $checkvh = DB::table("vhosts")
            ->select('unid')
            ->where ("unid" , $vhostid)
            ->get();
        if (!$checkvh OR !$checkdom) {return $error = "Trying to link non-existent domain";}
        else {return true;}
    }
}

Empirically found out that this part of the line causes the error: class Site extends Controller

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Victor, 2017-05-05
@v_decadence

use App capitalized?

T
Tesla, 2017-05-06
@Tesla

Do php artisan make:controller Siteit and see how it should be right, what paths and namespaces should be. And then remove your class and use artisan to create it.
If something is autoloaded and the class is still not found, trycomposer dump-autoload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question