PHP code example of afrittella / back-project

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

    

afrittella / back-project example snippets


Afrittella\BackProject\BackProjectServiceProvider::class,


'permission' => Afrittella\BackProject\Models\Permission::class,
'role' => Afrittella\BackProject\Models\Role::class,

  'social_login_enabled' => [
    'facebook' => true, // enable facebook login
    'twitter' => true, // enable twitter login
    'linkedin' => true // enable linkedin login
  ],
  

    ...
    'facebook' => [
        'client_id' => env('FACEBOOK_ID'),
        'client_secret' => env('FACEBOOK_SECRET'),
        'redirect' => env('FACEBOOK_REDIRECT'),
    ],

    'twitter' => [
        'client_id' => env('TWITTER_ID'),
        'client_secret' => env('TWITTER_SECRET'),
        'redirect' => env('TWITTER_REDIRECT'),
    ],

    'linkedin' => [
        'client_id' => env('LINKEDIN_ID'),
        'client_secret' => env('LINKEDIN_SECRET'),
        'redirect' => env('LINKEDIN_REDIRECT'),
    ]
    

Afrittella\BackProject\Models\Auth\User;

...
'providers' => [
  'users' => [
      'driver' => 'eloquent',
      'model' => Afrittella\BackProject\Models\Auth\User::class,
  ],
  ...

public function bCAuthorize($ability, $record = [])
{
     if ($record->user_id !== Auth::user()->id) {
         abort(403);
     }
}

...
use Afrittella\BackProject\Exceptions\BackProjectHandler;
use Afrittella\BackProject\Exceptions\BaseException;

class Handler extends ExceptionHandler
{
    ...

    public function render($request, Exception $exception)
    {
        ...

        if ($exception instanceof BaseException) {
            if ($response = BackProjectHandler::getResponse($exception)) {
                return $response;
            }
        }

        ...

        return parent::render($request, $exception);
    }
}

return array(

    /*
    |--------------------------------------------------------------------------
    | Name of route
    |--------------------------------------------------------------------------
    |
    | Enter the routes name to enable dynamic imagecache manipulation.
    | This handle will define the first part of the URI:
    |
    | {route}/{template}/{filename}
    |
    | Examples: "images", "img/cache"
    |
    */

    'route' => [FIRST PART OF THE URI YOU WANT FOR DISPLAYING IMAGES],

    /*
    |--------------------------------------------------------------------------
    | Storage paths
    |--------------------------------------------------------------------------
    |
    | The following paths will be searched for the image filename, submited
    | by URI.
    |
    | Define as many directories as you like.
    |
    */

    'paths' => array(
	// Insert here your uploads directory
        public_path('upload'),
        public_path('images')        
    ),

    /*
        |--------------------------------------------------------------------------
        | Manipulation templates
        |--------------------------------------------------------------------------
        |
        | Here you may specify your own manipulation filter templates.
        | The keys of this array will define which templates
        | are available in the URI:
        |
        | {route}/{template}/{filename}
        |
        | The values of this array will define which filter class
        | will be applied, by its fully qualified name.
        |
        */

        'templates' => array(
            'small' => 'Intervention\Image\Templates\Small',
            'medium' => 'Intervention\Image\Templates\Medium',
            'large' => 'Intervention\Image\Templates\Large',
        ),

        /*
        |--------------------------------------------------------------------------
        | Image Cache Lifetime
        |--------------------------------------------------------------------------
        |
        | Lifetime in minutes of the images handled by the imagecache route.
        |
        */

        'lifetime' => 43200,

    );


...
use Afrittella\BackProject\Traits\HasOneAttachment;
...

class Model
{
    use HasOneAttachment;

    ...
}

php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="config"

php artisan vendor:publish --provider="Prologue\Alerts\AlertsServiceProvider"

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"

php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"


php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="lang"

php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="adminlte"

php artisan vendor:publish --provider="Laravolt\Avatar\ServiceProvider"

php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="public"

php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="errors"

php artisan vendor:publish --provider="Afrittella\BackProject\BackProjectServiceProvider" --tag="views"

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"

php artisan migrate

php artisan back-project:seed-permissions

php artisan back-project:seed-menus
 php artisan queue:table
 php artisan queue:failed-table