NOMGUY
237
20
Laravel

Showing latest project

Posted 6 months ago by NOMGUY

Hi, guys. I have four tables:

Projects
id name created_at updated_at

-----------------------------------------

Tasks
id project_id created_at updated_at

-----------------------------------------

Credentials
id project_id created_at updated_at

-----------------------------------------

Wikis
id project_id created_at updated_at

and the relation goes like:

Project Model
hasMany('App\Tasks');

Task
belongsTo('App\Project');

Credential
belongsTo('App\Project');

Wiki
belongsTo('App\Project');

The scenario is, we have to show the latest Project when we make any change in the Tasks, Credentials or Wikis table. Only the project details to be shown if any changes are made in Tasks, Credentials or Wikis table orderBy updated_at.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.