PHP code example of thiagoprz / eloquent-composite-key

1. Go to this page and download the library: Download thiagoprz/eloquent-composite-key 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/ */

    

thiagoprz / eloquent-composite-key example snippets



...
// Returns model instance or null
$user = User::find([
    'key_1' => $key1,
    'key_2' => $key2,
]);
...
// Throws ModelNotFoundException
$user = User::findOrFail([
    'key_1' => $key1,
    'key_2' => $key2,
]);
...