1. Go to this page and download the library: Download internetguru/laravel-common 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/ */
// Controller - the e-mail is normalized in the validated array *and* in the request
$validated = $request->validate(['email' => '
// Livewire - the property itself is rewritten, which is what the component reads next
public string $email = ' Fó[email protected] ';
$this->validate(['email' => '
enum OrderStatus: string implements HasLabel
{
use RendersLabel;
case PAID = 'paid';
case UNPAID = 'unpaid';
public function label(): string
{
return match ($this) {
self::PAID => __('order.status.paid'),
self::UNPAID => __('order.status.unpaid'),
};
}
public function variant(): ?string
{
return match ($this) {
self::PAID => 'success',
self::UNPAID => 'danger',
};
}
}
use InternetGuru\LaravelCommon\Traits\AssociationHistory;
class Reservation extends Model
{
use AssociationHistory;
protected array $associationHistoryTracked = ['status', 'note'];
}
use Illuminate\Database\Eloquent\Model;
use InternetGuru\LaravelCommon\Casts\CarbonIntervalCast;
class Task extends Model
{
protected $casts = [
'duration' => CarbonIntervalCast::class,
];
}
use InternetGuru\LaravelCommon\Traits\Ulid32;
class Order extends Model
{
use Ulid32;
}
// Class-based
use InternetGuru\LaravelCommon\Rules\Ulid32;
$request->validate([
'code' => ['e' => '