2015-07-12 2 views
0

Ошибка я получаюКласс ошибок не существует

ReflectionException in compiled.php line 1082: 
Class App\Repositories\Frontend\Lewp does not exist 

Вот более длинное сообщение об ошибке

in compiled.php line 1082 
at ReflectionParameter->getClass() in compiled.php line 1082 
at Container->getDependencies(array(object(ReflectionParameter)), array()) in compiled.php line 1074 
at Container->build('App\Http\Controllers\Frontend\FrontendController', array()) in compiled.php line 1012 
at Container->make('App\Http\Controllers\Frontend\FrontendController', array()) in compiled.php line 1550 
at Application->make('App\Http\Controllers\Frontend\FrontendController') in compiled.php line 8791 
at ControllerDispatcher->makeController('App\Http\Controllers\Frontend\FrontendController') in compiled.php line 8780 
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Frontend\FrontendController', 'lewp') in compiled.php line 7759 
at Route->runWithCustomDispatcher(object(Request)) in compiled.php line 7730 
at Route->run(object(Request)) in compiled.php line 7383 
at Router->Illuminate\Routing\{closure}(object(Request)) 
at call_user_func(object(Closure), object(Request)) in compiled.php line 9455 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
at call_user_func(object(Closure), object(Request)) in compiled.php line 9437 
at Pipeline->then(object(Closure)) in compiled.php line 7384 
at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 7372 
at Router->dispatchToRoute(object(Request)) in compiled.php line 7357 
at Router->dispatch(object(Request)) in compiled.php line 2066 
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) 
at call_user_func(object(Closure), object(Request)) in compiled.php line 9455 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2637 
at VerifyCsrfToken->handle(object(Request), object(Closure)) in VerifyCsrfToken.php line 17 
at VerifyCsrfToken->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12699 
at ShareErrorsFromSession->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11348 
at StartSession->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12437 
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12376 
at EncryptCookies->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2687 
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) 
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9447 
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) 
at call_user_func(object(Closure), object(Request)) in compiled.php line 9437 
at Pipeline->then(object(Closure)) in compiled.php line 2013 
at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 1999 
at Kernel->handle(object(Request)) in index.php line 54 
at require_once('C:\projects\lewp\public\index.php') in server.php line 21 

Я не уверен, что у меня есть все установки правильно. Работали над попыткой правильно настроить эту настройку и действительно борется с тем, как все придает друг другу.

<?php namespace App\Http\Controllers\Frontend; 

use App\Http\Controllers\Controller; 
use App\Repositories\Frontend\Lewp as Lewp; 

/** 
* Class FrontendController 
* @package App\Http\Controllers 
*/ 
class FrontendController extends Controller { 
    protected $lewp; 

    function __construct(Lewp $lewp) { 
     $this->lewp = $lewp; 
    } 
    /** 
    * @return \Illuminate\View\View 
    */ 
    public function index() 
    { 
     return view('frontend.index'); 
    } 

    /** 
    * @return \Illuminate\View\View 
    */ 
    public function macros() 
    { 
     return view('frontend.macros'); 
    } 
    public function post() 
    { 
     return view('frontend.post'); 
    } 
    public function exterior() 
    { 
     return view('frontend.exterior'); 
    } 
    public function submit() 
    { 
     return view('frontend.submit'); 
    } 
    public function self() 
    { 
     return view('frontend.self'); 
    } 
    public function lewp($name) 
    { 
     if(strlen($name) == 0) 
     { 
      return view('frontend.index'); 
     } 
     $lewp = $this->lewp->getLewpByName($name); 
     return view::make('frontend.lewp', array('lewp' => $lewp)); 
    } 
} 

Вот модель

<?php namespace App; 

use Illuminate\Database\Eloquent\Model; 
use Illuminate\Database\Eloquent\SoftDeletes; 

class Lewp extends Model 
{ 
    use SoftDeletes; 
    /** 
    * The database table used by the model. 
    * 
    * @var string 
    */ 
    protected $table = 'lewps'; 

    /** 
    * The attributes that are not mass assignable. 
    * 
    * @var array 
    */ 
    protected $guarded = ['id']; 

    /** 
    * The attributes excluded from the model's JSON form. 
    * 
    * @var array 
    */ 
    protected $hidden = []; 

    /** 
    * For soft deletes 
    * 
    * @var array 
    */ 
    protected $dates = ['deleted_at']; 
} 

Вот хранилище

<?php namespace App\Repositories\Frontend; 

use App\Lewp; 
use App\Exceptions\GeneralException; 


/** 
* Class EloquentUserRepository 
* @package App\Repositories\Lewp 
*/ 
class EloquentLewpRepository implements LewpContract { 

    public function __construct(Lewp $lewpRepository) 
    { 
     $this->lewpRepository = $lewpRepository; 
    } 

    /** 
    * @param $id 
    * @return \Illuminate\Support\Collection|null|static 
    * @throws GeneralException 
    */ 
    public function findOrThrowException($id) { 
     $lewp = Lewp::find($id); 
     if (! is_null($lewp)) return $lewp; 
     throw new GeneralException('That lewp does not exist.'); 
    } 

    /** 
    * @param $data 
    * @param bool $provider 
    * @return static 
    */ 

    public function create($data) { 
     $lewp = Lewp::create([ 
      'name' => $data['name'], 
      'title' => $data['title'], 
      'text' => $data['text'], 
      'sidebar' => $data['sidebar'], 
      'submission_text' => $data['submission_text'], 
      'type' => $data['type'], 
      'content_options' => $data['content_options'], 
      'link_button_text' => $data['link_button_text'], 
      'text_button_text' => $data['text_button_text'], 
      'options' => $data['options'], 
      'comment_sort_method' => $data['comment_sort_method'], 
      'hide_comment_scores' => $data['hide_comment_scores'], 
      'header_mouseover-text' => $data['header_mouseover-text'] 
     ]); 

     return $lewp; 
    } 

    public function searchLewpsByName($term) { 
     $lewp = Lewp::where('name', 'LIKE', $term)->get(); 

     return $lewp; 
    } 

    public function getLewpByName($lewpname) { 
     $lewp = Lewp::where('name', '=', $lewpname)->first(); 

     return $lewp; 
    } 

    public function getLewpId($lewpname) { 
     $lewp = Lewp::select(array('id')->where('name', '=', $lewpname)->first(); 

     return $lewp; 
    } 

} 
+0

Включили ли вы свой класс в composer.json? Если это так, вы запустили? 'Comper dump-autoload' –

ответ

1

в классе Lewp затруднительного:

namespace App\Repositories\Frontend; 
+0

Здравствуйте, я изменил это, и я все равно получаю ту же ошибку. Тот, который я изменил, был из приложения namespace App; к тому, что вы предложили. – Joe

Смежные вопросы