PHP code example of luilliarcec / laravel-utilities
1. Go to this page and download the library: Download luilliarcec/laravel-utilities 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/ */
luilliarcec / laravel-utilities example snippets
// ...
use Luilliarcec\Utilities\Concerns\SetAttributesUppercase;
class User extends Authenticable
{
use SetAttributesUppercase;
}
// ...
use Luilliarcec\Utilities\Concerns\SetAttributesUppercase;
class User extends Authenticable
{
use SetAttributesUppercase;
protected $dontApplyCase = [
'username'
];
}
// ...
use Luilliarcec\Utilities\Concerns\BelongsToAuthenticated;
class Invoice extends Model
{
use BelongsToAuthenticated;
}
use Luilliarcec\Utilities\Rules\Authenticated;
Request::validate([
'invoice_id' => Authenticated::make('invoices', 'id')->exists() // ->where(...)
]);
use Luilliarcec\Utilities\Rules\Decimals;
Request::validate([
'amount' => new Decimals // by default they are 8 integers and 2 decimals
]);
Request::validate([
'amount' => new Decimals(20, 4) // 20 integers and 4 decimals
]);