PHP code example of icarojobs / corehelper

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

    

icarojobs / corehelper example snippets


use Modules\CoreHelper\Http\Controllers\DateController;
$date = DateController::date_to_br('2017-08-17');
$date = DateController::date_to_us('17/08/2017');

use Modules\CoreHelper\Http\Controllers\MoneyController;

$money = MoneyController::money_to_us('350,45');

$money = MoneyController::money_to_br('350.45');

use Modules\CoreHelper\Http\Controllers\StringController;

$string = StringController::clear_string("É mano, remove essa ação pra nóis");

use Modules\CoreHelper\Http\Controllers\ValidatorController;

$cpf = ValidatorController::cpf_validate('322.867.222-51');

$cnpj = ValidatorController::cnpj_validate('75.305.113/0001-02');

use Modules\CoreHelper\Notifications\SlackNotifications;

$dados = [
        'channel'   =>  '#notifications',
        'from'      =>  'MOB2YOU Notifications',
        'emoji'     =>  ':mob2you:', // :ghost: , etc...
        'message'   =>  'First Test Slack Notification 3'
    ];

    new SlackNotifications($dados);

use Modules\Crud\Http\Controllers\CrudControllerTrait;

class MyRestfulController extends Controller
{
    use CrudControllerTrait;

    protected $model;

    public function __construct(\App\Models\User $model)
    {
        $this->model = $model;
    }

    public function index(Request $request)
    {

        // Get specific user
        // $user = $this->show(1);
        // $userObject = json_decode( $user->content() , false);
        // dd($userObject->name);

        // Get all users
        // $users = $this->all($request);
        // $usersObject = json_decode( $users->content(), false );
        // dd($usersObject->data);
    }
}