Laravel 4: Confused about how to use App::make()
App is actually a facade for Laravel IoC container usually used for automatic resolution. Understanding of IoC concept is vital for complex application development but small projects will benefit from well architecture for sure. I would recommend to dive into Laravel documentation first and try some examples on Service Providers, Bindings and Automatic Resolution.
Speaking about your example:
namespace My;class NewClass { function __construct($id, $title) { $this->id = $id; $this->title = $title; }}$newClass = App::make('My\NewClass', [1, 'test']);
The good people in the Laravel forum answered this one for me http://laravel.io/forum/02-10-2014-laravel-4-confused-about-how-to-use-appmake
Pretty much if you can bind custom instantiation code with App::bind(); like so
App::bind('My\NewClass', function() use ($classArgs) { return new My\NewClass($classArgs['id'], $classArgs['title']);});// get the binding$newClass = App::make('My\NewClass');