1. Go to this page and download the library: Download rtroncoso/laravel-context library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
Route::group(['prefix' => 'admin', 'middleware' => 'context:backend', function() {
// Your contextually loaded routes go here
}]);
Route::group(['prefix' => 'admin', 'middleware' => 'context', 'context' => 'backend', function() {
// Your contextually loaded routes go here
}]);
namespace Contextual\Providers;
use Illuminate\Support\ServiceProvider;
class BackendServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('Your\\Interfaces\\UserRepositoryInterface', 'Your\\Repositories\\Backend\\UserRepository');
// Make more awesome bindings here!
}
}
Context::load('context');
$currentContext = Context::current();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.