PHP code example of envor / platform

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

    

envor / platform example snippets


// config/database.php
return [
        /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once throughout the application.
    |
    */

    'platform' => env('PLATFORM_DB_CONNECTION', 'sqlite'),
    'default' => env('DB_CONNECTION', 'sqlite'),
];

// config/auth.php
return [
    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_reset_tokens',
            'connection' => env('PLATFORM_DB_CONNECTION', 'sqlite'),
            'expire' => 60,
            'throttle' => 60,
        ],
    ],
];

// config/platform.php

return [
    'landing_page_disk' => env('LANDING_PAGE_DISK', 'public'),
    'profile_photo_disk' => env('PROFILE_PHOTO_DISK', 'public'),
    'stores_contact_info' => env('STORES_CONTACT_INFO', true),
    'empty_logo_path' => 'profile-photos/no_image.jpg',
    'empty_phone' => '(_ _ _) _ _ _- _ _ _ _',
    'empty_fax' => '(_ _ _) _ _ _- _ _ _ _',
    'logo_path' => env('PLATFORM_LOGO_PATH'),
    'name' => env('PLATFORM_NAME'),
    'phone' => env('PLATFORM_PHONE_NUMBER'),
    'fax' => env('PLATFORM_FAX_NUMBER'),
    'street_address' => env('PLATFORM_STREET_ADDRESS'),
    'city_state_zip' => env('PLATFORM_CITY_STATE_ZIP'),
    'email' => env('PLATFORM_EMAIL'),
];

// config/session.php



return [
    'connection' => env('PLATFORM_DB_CONNECTION'),
];


class Business extends Model
{
    use \Envor\Platform\UsesPlatformConnection;
}

$table->uuid('uuid')->index()->unique();

class Business extends Model
{
    use \Envor\Platform\HasPlatformUuids;
}

$table->text('profile_photo_path')->nullable();


...
class User extends Authenticatable
{
    ...
    use \Envor\Platform\HasProfilePhoto;
    ...
}

$user->updateProfilePhoto($request->file('photo'));


...
class User extends Authenticatable
{
    ...
    use \Envor\Platform\HasLandingPage;
    ...
}

$user->updateLandingPage($request->file('landing-page'));

$table->string('domain')->nullable();

use Illuminate\Http\Request;

Route::get('/', function (Request $request) {

    $user = \App\Models\User::where('domain', $request->getHost())->first();

    if ($user?->landingPage) {
        return response()->file(Storage::disk($user->landingPageDisk())->path($user->landingPagePath()));
    }

    return view('welcome');

})->name('home');


$table->text('contact_data')->nullable();

...
class User extends Authenticatable
{
    ...
    use \Envor\Platform\HasContactData;
    ...
}

$user->updateContactData([
    'name' => 'Jane Doe',
    'address' => [
        '1234 somewhere lane'
    ];
]);
bash
php artisan vendor:publish --tag="platform-config"
bash
php artisan volt:install
bash
php artisan vendor:publish --tag='platform-migrations'
bash
php artisan migrate --path=database/migrations/platform
bash
php artisan volt:install
bash
php artisan volt:install
blade
@livewire('update-contact-info-form', ['model' => $user, 'readonly' => $user->id != auth()->id()])