1. Go to this page and download the library: Download vi-kon/laravel-auth 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/ */
vi-kon / laravel-auth example snippets
// to providers array
\ViKon\Auth\AuthServiceProvider::class,
// to aliases array
'RouterAuth' => \ViKon\Auth\Facades\RouterAuth::class,
// Single route
Route::get('/', [
'middleware' => 'auth.has-access',
'permission' => 'access.some.controller',
'uses' => 'SomeController@index',
]);
// Multiple routes in group
Route::group(['middleware' => 'auth.has-access'], function () {
// ...
Route::get('/', [
'permission' => 'access.some.controller',
'uses' => 'SomeController@index',
]);
// ...
});
class CreateProfileTable extends Migration
{
public function up()
{
Schema::create('user_profile', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
// Foreign connection to user table
$table->unsignedInteger('user_id')
->unique();
$table->foreign('user_id')
->references('id')
->on('users')
->onUpdate('cascade')
->onDelete('cascade');
});
}
public function down()
{
Schema::drop('user_profile');
}
}