0
I moved my production bank ,to site the production base returns the objects already my local database appears this message
My projectController
/**
* Lista todos os projetos ativos
* @access public
* @param NULL
* @return arrProjetos para a view('pmo.projetos')
*/
public function listarProjetos() {
//DB::enableQueryLog();
$arrProjetos = Projetos::all();
$arrProjetosPendentes = array();
$arrProjetosInativos = array();
$intIndex = 0;
foreach ($arrProjetos as $objProjeto) {
$objDataConclusaoLimite = new DateTime($objProjeto->data_conclusao_realizada);
$objDataConclusaoLimite->add(new DateInterval('P12D')); // Inserindo + 7 dias a data de conclusão
$objDataAtual = new DateTime(); // Pegando a data atual
// Seprando projetos com status 4 (Excluidos)
if ($objProjeto->status == self::Excluido) {
array_push($arrProjetosInativos, $arrProjetos[$intIndex]);
unset($arrProjetos[$intIndex]);
}
// Seprando projetos pendentes
elseif ($objProjeto->status == self::Pendente) {
array_push($arrProjetosPendentes, $arrProjetos[$intIndex]);
unset($arrProjetos[$intIndex]);
}
// Mudando status de projetos concluidos a mais de 7 dias
elseif ($objDataConclusaoLimite < $objDataAtual) {
$objProjeto->status = self::Excluido;
$objProjeto->save();
}
$intIndex++;
/**
* Lista todos os projetos
* @access public
* @param NULL
* @return Array $arrProjetos para a view('pmo.projetos')
*/
public function listarTodos() {
$arrProjetos = Projetos::all();
foreach($arrProjetos as $objProjeto) {
$objDono = Stakeholders::find($objProjeto->dono);
$objProjeto->dono = $objDono->nome;
}
return view('pmo.admin.projetos', compact('arrProjetos'));
}
}
I tried to do using this post Trying to get Property of non-object still nothing , the question is with the same information only that local ,not be returning data from the object . The database is SQL Server 2014 Project done in Laravel 5.3 My models : are separated into
Area :
class Area extends Model{
public $timestamps = false;
protected $table = 'area';
protected $IntId = 'id';
protected $fillable = ['nome'];
}
Commentary :
class Comentario extends Model{
public $timestamps = false;
protected $table = 'comentarios';
protected $IntId = 'id';
protected $IntIdProjeto = 'id_projeto';
protected $IntIdStakeholder = 'id_stakeholder';
protected $strComentario = 'comentario';
protected $strData = 'data_publicado';
protected $boolExcluido = 'excluido';
public function projetos() {
return $this->belongsToOne('App\Models\Projetos', 'projeto', 'id', 'id_projeto');
}
public function stakeholders() {
return $this->belongsToone('App\Models\Stakeholders', 'stakeholders', 'id', 'id_stakeholder');
}
/*public function roles() {
return $this->belongsToMany('App\Models\Projetos','projeto_stakeholders','id_projeto','id_stakeholder')
}*/ }
Projects :
class Projetos extends Model{
public $timestamps = false;
protected $table = 'projetos';
protected $IntId = 'id';
protected $fillable = array('nome', 'area', 'data_criacao', 'data_conclusao_prevista',
'status', 'porcentagem', 'codigo', 'dono', 'descricao');//campos da tabela
protected $strDataUltimaAtualizacao = 'data_ultima_atualizacao';
protected $strArquivo = 'arquivo';
protected $strDescricao = 'descricao';
protected $strDataArquivoAtualizacao = 'data_arquivo_atualizacao';
public function areas() {
return $this->hasOne('App\Models\Area', 'id', 'area');
}
public function stakeholders() {
return $this->belongsToMany('App\Models\Stakeholders', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
public function comentario() {
return $this->hasMany('App\Models\Comentario', 'id_projeto', 'id');
}
public function roles() {
return $this->belongsToMany('App\Models\Projetos',
'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
Responsible :
class Responsavel extends Model{
public $timestamps = false;
protected $table = 'responsavel';
protected $IntId = 'id';
protected $fillable = array('login', 'nome', 'email');
public function projetos() {
return $this->hasMany('App\Projetos');
}
} Stakeholders
class Stakeholders extends Model{
public $timestamps = false;
protected $table = 'stakeholders';
protected $IntId = 'id';
protected $fillable = array('login', 'nome', 'email');
protected $boolAdmin = 'admin';
protected $boolBoss = 'boss';
protected $strSenha = 'senha';
protected $strTokenResetarSenha = 'token_resetar_senha';
public function projetos() {
return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
public function comentario() {
return $this->hasMany('App\Models\Comentario', 'id_stakeholder', 'id');
}
public function roles() {
return $this->belongsToMany('App\Models\Projetos', 'projeto_stakeholders', 'id_projeto', 'id_stakeholder');
}
These are my system models
Put the complete Design Codecontroller to take a look? I think you just copied the functions there in the statement..
– Darlei Fernando Zillmer
$arrProjetos = Projetos::all()->get();
I tried to do it and it doesn’t work.. It’s a mistake because the database I created is wrong ?– Ricardo Mendes
There is a lot of code, is all this necessary, what is the purpose of your code? did you make the list of Models correctly? I’ve seen a lot that can be suppressed, but it’s hard to answer because of your rule or context ...
– novic
The purpose is a certain user ,to be able to view all the projects that exist in the system (database)
– Ricardo Mendes
I get it, but do you think you need to do it? Come on, how are your models? What’s your chart like? Have with posting? because the error is another problem is that if you relate everything right need not write as much!
– novic
Because it has
protected $strDataUltimaAtualizacao = 'data_ultima_atualizacao';
????– novic
is when some project of some stakeholder is updated, it always picks up the date of the last update
– Ricardo Mendes
Look Ricardo I’m really more in doubt than you, because, I’ve never seen anyone do so ... !!! sorry! Let’s see if anyone can help you, I don’t think you need to but, ... !
– novic
I’m having trouble creating the Migrations.. the project did not have the Migration folder, I created it manually and when I try to create the Migration related to my object this error appears
[Symfony\Component\Console\Exception\RuntimeException]
 Too many arguments, expected arguments "command" "name".
I want to create the bank from scratch to climb this project already created...– Ricardo Mendes