1. Go to this page and download the library: Download oi-lab/oi-laravel-notes 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/ */
oi-lab / oi-laravel-notes example snippets
return [
// Model used for the note author relationship
'user_model' => 'App\Models\User',
// Model classes used by the package — override with your own subclasses
'models' => [
'note' => OiLab\OiLaravelNotes\Models\Note::class,
],
// Validation limits applied by NoteRequest
'attachments' => [
'max_files' => 10,
'max_file_size' => 10240, // kilobytes
],
];
use Illuminate\Database\Eloquent\Model;
use OiLab\OiLaravelNotes\Concerns\HasNotes;
class Order extends Model
{
use HasNotes;
}
$order->notes()->create([
'message' => 'Customer called to confirm the address.',
'user_id' => auth()->id(),
]);
$order->notes; // all notes (MorphMany)
$order->notes()->latest()->first();