PHP code example of yaroslawww / laravel-thinkit

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

    

yaroslawww / laravel-thinkit example snippets


\ThinKit\Helpers\Sql::readableSqlFromQuery(MyModel::whereKey(123));

\ThinKit\Helpers\Url::addOrUpdateArgs('https://my.path.co.uk?example=foo&test=bar', 'new', 'baz');

$formats = [
            'Y-m-d',
            'Y-m-d\TH:i:s',
        ];
        
$carbonDate = \ThinKit\Helpers\DateTime::createFromMultipleFormats($formats, '2022-09-28T08:19:00');
$carbonDate->format('Y-m-d H:i:s');

use ThinKit\Enums\HasNames;
use ThinKit\Enums\NamedEnum;

enum SalesCallType: string implements NamedEnum
{
    use HasNames;

    case GENERAL = 'general';
    case EVENT = 'event';
    case AWARD = 'award';
}

SalesCallType::GENERAL->name() // translation label
SalesCallType::options() // ["<value>" => "<translation label>"]
SalesCallType::formattedOptions() // [["value" => "<value>", "label" => "<translation label>"]]
bash
php artisan vendor:publish --provider="ThinKit\ServiceProvider" --tag="config"