PHP code example of grafite / builder

1. Go to this page and download the library: Download grafite/builder 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/ */

    

grafite / builder example snippets


composer 

php artisan vendor:publish

php artisan vendor:publish --provider="Yab\CrudMaker\CrudMakerProvider"
php artisan vendor:publish --provider="Yab\FormMaker\FormMakerProvider"

'admin' => \App\Http\Middleware\Admin::class,
'permissions' => \App\Http\Middleware\Permissions::class,
'roles' => \App\Http\Middleware\Roles::class,
'active' => \App\Http\Middleware\Active::class,

'active'

App\Models\User::class

Gate::define('admin', function ($user) {
    return ($user->roles->first()->name === 'admin');
});

Gate::define('team-member', function ($user, $team) {
    return ($user->teams->find($team->id));
});

'App\Events\UserRegisteredEmail' => [
    'App\Listeners\UserRegisteredEmailListener',
],

'testing' => [
    'driver'   => 'sqlite',
    'database' => ':memory:',
    'prefix'   => '',
],

'passwords' => [
    'users' => [
        'provider' => 'users',
        'email' => 'emails.password',
        'table' => 'password_resets',
        'expire' => 60,
    ],
],

MAIL_DRIVER=log

php artisan grafite:starter

composer dump-autoload

php artisan migrate --seed

php artisan grafite:activity

App\Providers\ActivityServiceProvider::class,

Activity::log($description);
Activity::getByUser($userId);

activity($description) // will log the activity

php artisan grafite:features

App\Providers\FeatureServiceProvider::class,



Features::isActive($key);

@feature($key)
// code goes here
@endfeature

feature($key) // will return true|false

php artisan grafite:logs



php artisan grafite:notifications



Notifications::notify($userId, $flag, $title, $details);

composer 

php artisan grafite:forge

->group(function () {
    utes/forge.php');
}

FORGE_TOKEN=
FORGE_SERVER_ID=
FORGE_SITE_ID=

composer 



'jwt.auth' => \Tymon\JWTAuth\Middleware\GetUserFromToken::class,
'jwt.refresh' => \Tymon\JWTAuth\Middleware\RefreshToken::class,

'api/v1/login',
'api/v1/user/profile',

RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

\App\Models\User::class

php artisan grafite:queue



composer 

Laravel\Socialite\SocialiteServiceProvider::class

'Socialite' => Laravel\Socialite\Facades\Socialite::class,

Route::middleware('web')
    ->namespace($this->namespace)
    ->group(function () {
        

'github' => [
    'client_id' => 'id code',
    'client_secret' => 'secret code',
    'redirect' => 'http://your-domain/auth/github/callback',
    'scopes' => ['user:email'],
],

composer 

->group(function () {
    utes/billing.php');
}

SUBSCRIPTION=app_basic
STRIPE_SECRET=secret-key
STRIPE_PUBLIC=public-key

Gate::define('access-billing', function ($user) {
    return ($user->meta->subscribed('main') && is_null($user->meta->subscription('main')->endDate));
});

'stripe' => [
    'model'  => App\Models\UserMeta::class,
    'key'    => env('STRIPE_PUBLIC'),
    'secret' => env('STRIPE_SECRET'),
],

php artisan migrate

<li><a href="{{ url('user/billing/details') }}"><span class="fa fa-dollar"></span> Billing</a></li>

<strong>To:</strong> {{ $user->user()->email }}

php artisan grafite:starter

php artisan grafite:bootstrap

php artisan grafite:api

php artisan grafite:socialite

php artisan grafite:billing