This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Middleware; | |
use Closure; | |
class AgeMiddleware { | |
public function handle($request, Closure $next){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
.... | |
'providers' => [ | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// web.php | |
Route::get('/', function () { | |
return Student::getName(); | |
}); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use App; | |
use Illuminate\Support\ServiceProvider; | |
class FacadeServiceProvider extends ServiceProvider { | |
public function boot() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Facades; | |
class Student extends \Illuminate\Support\Facades\Facade | |
{ | |
public static function getFacadeAccessor() | |
{ | |
return 'student'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Student.php | |
namespace App\Student; | |
class Student | |
{ | |
public function getName() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UserController extends BaseController { | |
protected $user_repo = null; | |
// UserRepositoryInterface is the interface | |
public function __construct(UserRepositoryInterface $user_repo) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Repositories; | |
use App\Product; | |
<?php | |
class UserRepository implements UserRepositoryInterface { | |
public function getAllUsers() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface UserRepositoryInterface { | |
public function getAllUsers(); | |
public function getUserById($id); | |
public function createOrUpdate($id = null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
'providers' => [ | |
/* | |
* Laravel Framework Service Providers... | |
*/ | |
... | |
App\Providers\RepoServiceProvider::class, | |
... | |
], |