2015-01-29 3 views
0

나는 부서진 장인을 상대하고 있습니다. 매번 내가 말하는 모든 마이그레이션 명령을 실행 :숙련공이 고장났습니다 : 정의되지 않은 재산

[ErrorException] 
    Undefined property: Illuminate\Database\Query\Builder::$projects 

내가 프로젝트 테이블을 삭제하고 그냥 다시 마이그레이션 명령을 실행할 수 없습니다 모델링 아무리. 나는 사용자와 프로젝트 사이의 관계를 만들었고 사용자는 많은 프로젝트를 가질 수 있었고 그 이후로 내 전체 응용 프로그램이 깨져 보였습니다. Auth::check() 같은 오류가 나타납니다.

프로젝트 모델 :

class Projects extends Eloquent { 
    public function user() { 
     return $this->belongsTo("User"); 
    } 

    public function android_app_entries() { 
     return $this->hasMany("AndroidAppEntries"); 
    } 
} 

사용자 모델 :

class User extends Eloquent implements UserInterface, RemindableInterface { 

    use UserTrait, RemindableTrait; 

    protected $table = 'users'; 

    public static $rules = array(
     'username'=>'required|between:6,18', 
     'password'=>'required|between:6,18', 
     'project_id'=>'required' 
    ); 

    // Artist __has_many__ projects 
    public function projects() 
    { 
     return $this->hasMany('Projects'); 
    } 

프로젝트 마이그레이션 파일 :

<?php 

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateProjectsTable extends Migration { 

    /** 
    * Run the migrations. 
    * 
    * @return void 
    */ 
    public function up() 
    { 
     Schema::create('projects', function($table) { 
      $table->increments('id'); 
      $table->string('project_name'); 
      $table->string('client_name'); 
      $table->integer('users_id'); 
      $table->foreign('users_id')->references('id')->on('users'); 
      $table->timestamps(); 
     }); 



    } 

    /** 
    * Reverse the migrations. 
    * 
    * @return void 
    */ 
    public function down() 
    { 
     Schema::drop('projects'); 
    } 

사용자 마이그레이션 파일 :

<?php 

use Illuminate\Database\Schema\Blueprint; 
use Illuminate\Database\Migrations\Migration; 

class CreateUsersTable extends Migration { 

/** 
* Run the migrations. 
* 
* @return void 
*/ 
public function up() 
{ 
    Schema::create('users', function($table){ 
     $table->increments('id'); 
     $table->string('username'); 
     $table->string('password', 64); 
     $table->string('role'); 
     $table->string('remember_token'); 
     $table->timestamps(); 
    }); 
} 

/** 
* Reverse the migrations. 
* 
* @return void 
*/ 
public function down() 
{ 
    Schema::drop('users'); 
} 

나는 다른 누군가도이 경험을했고 나를 도울 수 있기를 바라고 있습니다.

다른 메모 : 나는 장인이 만든 컨트롤러의 이름을 변경했습니다. 그것이 어떤 영향을 미치는지 확실하지 않습니다. 작곡가 덤프 자동로드가 확실하게나요 ..

업데이트 :

에도 완전히 모든 모델과 오류가 지속 전체 데이터베이스를 제거한 후. 심지어 오늘 밤에 변경하지 않고 오늘 오후에 작업 한 코드로 되돌아갔습니다. 그래서 내 생각 엔 .. 전체 설치에 결함이 가지고 있다는 것입니다

laravel.log :

[2015-01-29 21:29:03] local.ERROR: exception 'ErrorException' with message 'Undefined property: Illuminate\Database\Query\Builder::$projects' in /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php:56 
Stack trace: 
#0 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php(56): Illuminate\Exception\Handler->handleError(8, 'Undefined prope...', '/var/www/larave...', 56, Array) 
#1 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php(38): Illuminate\Database\Query\Grammars\Grammar->compileComponents(Object(Illuminate\Database\Query\Builder)) 
#2 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/MySqlGrammar.php(34): Illuminate\Database\Query\Grammars\Grammar->compileSelect(Object(Illuminate\Database\Query\Builder)) 
#3 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1234): Illuminate\Database\Query\Grammars\MySqlGrammar->compileSelect(Object(Illuminate\Database\Query\Builder)) 
#4 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1359): Illuminate\Database\Query\Builder->toSql() 
#5 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1349): Illuminate\Database\Query\Builder->runSelect() 
#6 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1336): Illuminate\Database\Query\Builder->getFresh(Array) 
#7 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1771): Illuminate\Database\Query\Builder->get(Array) 
#8 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1731): Illuminate\Database\Query\Builder->aggregate('max', Array) 
#9 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(105): Illuminate\Database\Query\Builder->max('batch') 
#10 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php(58): Illuminate\Database\Migrations\DatabaseMigrationRepository->getLastBatchNumber() 
#11 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(158): Illuminate\Database\Migrations\DatabaseMigrationRepository->getLast() 
#12 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/ResetCommand.php(61): Illuminate\Database\Migrations\Migrator->rollback(false) 
#13 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Console/Command.php(112): Illuminate\Database\Console\Migrations\ResetCommand->fire() 
#14 /var/www/laravel-develop/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#15 /var/www/laravel-develop/vendor/laravel/framework/src/Illuminate/Console/Command.php(100): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#16 /var/www/laravel-develop/vendor/symfony/console/Symfony/Component/Console/Application.php(889): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#17 /var/www/laravel-develop/vendor/symfony/console/Symfony/Component/Console/Application.php(193): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Migrations\ResetCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#18 /var/www/laravel-develop/vendor/symfony/console/Symfony/Component/Console/Application.php(124): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) 
#19 /var/www/laravel-develop/artisan(59): Symfony\Component\Console\Application->run() 
#20 {main} [] [] 
+0

다른 이전 서비스가 있습니까? 아니면 네가 도망 다니는 시더? 오류는 그 속성을 가지고 있지 않은 객체에서'-> projects'에 접근하는 것을 의미합니다. (아마 당신의 모델이라고 생각하고 관계에 액세스하려고 시도합니다.) – lukasgeiter

+0

네, 다른 이주가있었습니다. 어떤 종류의 프로젝트와 관련된 시더도 제거됩니다. 마침내, 재미있는 점은 전체 프로젝트에서'-> project'를 검색하면 아무런 결과도 없다는 것입니다. 캐시 문제 같은 것 같습니다. –

+0

관계를 제거하면 어떻게됩니까? – lukasgeiter

답변

0

또한 한 작업 복사본에서 공급 업체 laravel 코드를 롤백 결국 응용 프로그램 코드를 다시뿐만 아니라 압연 후 속임수. 이상하게도 공급 업체 디렉토리가 손상 될 수 있습니다.

관련 문제