title: Laravel using separate controller for separate logic
body: <p>I think we have separate controllers respective to separate logic or modules of our application, and i have also found that using a controller inside another controller is not a good practice.</p>
  
  <p>Here i have facing a difficulty.</p>
  
  <p>there are two controllers PagesController and PostsController</p>
  
  <p>PagesController handle all pages related tasks.</p>
  
  <pre><code>class PagesController 
  {
  
      public function index()
      {
           // method of our root request, get and show all posts
      }
  
      public function contactUs()
      {
          // show contact us page etc.
      }
  
  }
  </code></pre>
  
  <p>PostsController handle all posts related tasks.</p>
  
  <pre><code>class PostsController
  {
  
       public function getPosts() {} // get all posts from database
       public function deletePost($id) {} // delete a post
       public function editPost($id) {} // edit a post
  }
  </code></pre>
  
  <p>Now post controller handle all posts specific tasks and pages controller handle all pages related tasks. The problem is that i want to use posts controller getPosts() method to get all posts and pass them to view. How can i use PostsController's getPosts() method inside our PagesController index() method.</p>
  
  <p>One way is extends PostsController and use it. But what if we want to use another controller's method also.</p>
  
  <p>Please provide me better way to do that.</p>