PHP code example of monthly-cloud / monthly-sdk-laravel

1. Go to this page and download the library: Download monthly-cloud/monthly-sdk-laravel 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/ */

    

monthly-cloud / monthly-sdk-laravel example snippets


'providers' => [
    ...
    MonthlyCloud\Laravel\MonthlyCloudServiceProvider::class,
],

'aliases' => [
    ...
    'MonthlyCloud' => MonthlyCloud\Laravel\MonthlyCloud::class,
    'MonthlyStorage' => MonthlyCloud\Laravel\MonthlyStorage::class,
],

$property = MonthlyCloud::endpoint('properties')->find(1); // Single property
$properties = MonthlyCloud::endpoint('properties')->get(); // List of properties

MonthlyStorage::endpoint('routes')->get(); // get routes using default app language
MonthlyStorage::endpoint('menus')->locale('en')->get(); // get menus in pre-defined language
MonthlyStorage::endpoint('contents')->find(31); // find content
MonthlyStorage::endpoint('contents')->website(3)->id(31)->buildUrl(); // build file url for specific website and content id

MonthlyStorage::getListingItem()->find(100); // find listing item
MonthlyStorage::findContent(1); // quick way to find content
MonthlyStorage::getRoutes('en'); // quick way to access routes

/**
 * Get key from translations dictionary.
 *
 * @param string|null $key
 * @return string|array
 */
function __t($key = null)
{
	if (empty($key)) {
		return app(\MonthlyCloud\Laravel\Services\TranslationService::class)->getTranslations();
	}

	return app(\MonthlyCloud\Laravel\Services\TranslationService::class)->translate($key);
}
 bash
php artisan vendor:publish --provider="MonthlyCloud\Laravel\MonthlyCloudServiceProvider"

php artisan make:auth
php artisan migrate