PHP code example of dyrynda / laravel-efficient-uuid
1. Go to this page and download the library: Download dyrynda/laravel-efficient-uuid 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/ */
namespace App;
use Dyrynda\Database\Casts\EfficientUuid;
use Dyrynda\Database\Support\GeneratesUuid;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use GeneratesUuid;
protected $casts = [
'uuid' => EfficientUuid::class,
];
}
use Dyrynda\Database\Rules\EfficientUuidExists;
public function update(Request $request, User $user)
{
$request->validate([
// Using the default column name
'uuid' => [new EfficientUuidExists(Post::class)],
// Using a custom column name
'custom_uuid' => [new EfficientUuidExists(Post::class, 'custom_uuid')],
]);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.