Skip to content

Instantly share code, notes, and snippets.

View shikto1's full-sized avatar

Ahidul Islam shikto1

View GitHub Profile
<?php
namespace App\Http\Middleware;
use Closure;
class AgeMiddleware {
public function handle($request, Closure $next){
<?php
return [
....
'providers' => [
....
<?php
// web.php
Route::get('/', function () {
return Student::getName();
});
<?php
namespace App\Providers;
use App;
use Illuminate\Support\ServiceProvider;
class FacadeServiceProvider extends ServiceProvider {
public function boot() {
<?php
namespace App\Facades;
class Student extends \Illuminate\Support\Facades\Facade
{
public static function getFacadeAccessor()
{
return 'student';
<?php
// Student.php
namespace App\Student;
class Student
{
public function getName()
<?php
class UserController extends BaseController {
protected $user_repo = null;
// UserRepositoryInterface is the interface
public function __construct(UserRepositoryInterface $user_repo)
{
namespace App\Repositories;
use App\Product;
<?php
class UserRepository implements UserRepositoryInterface {
public function getAllUsers()
<?php
interface UserRepositoryInterface {
public function getAllUsers();
public function getUserById($id);
public function createOrUpdate($id = null);
<?php
'providers' => [
/*
* Laravel Framework Service Providers...
*/
...
App\Providers\RepoServiceProvider::class,
...
],