php - Laravel 5 - constantly repeating use statements -


is there central place can put 'use' statements don't have keep doing things every single controller create?

<?php namespace app/http/controllers  use session; use auth; use input; use log; use carbon; use response; use illuminate\routing\controller;  class blablacontroller extends controller {} 

just seems violate dryness , seems inefficient.

short answer: no.

the 'use' statements resolving namespaces file, can't inherit them other files. doesn't violate dry because there isn't logic being repeated.

now if don't want have include use statement in every controller can resolve facade out of global scope whenever use it. example following work namespace, without needing use statement.

\input::all(); 

in opinion looks little cleaner include use statement, either work.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -