title: Laravel dynamic class usage
body: <p>I need implement a system for class calling like this:</p>
  
  <p>Imagine there is a class Calendar.php handling database queries (or a model if you like) which should be used by default. If there is a need to implement some new behaviour I would like to implement a class MaterialCalendar.php which will extend the Calendar.php class so I will be able to use all the methods from the Calendar.php in the newly created MaterialCalendar.php with overriding parent methods if needed. </p>
  
  <p>The issue is how to implement this kind of behaviour used anywhere in the code, in a view or in a controller:</p>
  
  <p>if (child class exists) { use child class } else { use default parent class }</p>
  
  <p>This behaviour above in pseudocode should be dynamic, so if there is no MaterialCalendar.php Calendar.php should be used by default, if MaterialCalendar.php exists then that should be used. It needs to be dynamic, irrelevant of the class names used in this example.</p>