PHP code example of oi-lab / oi-laravel-notes

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();

$order->notes()->create([
    'message' => 'Status automatically advanced to shipped.',
    'has_bot' => true,
]);

use OiLab\OiLaravelAttachments\Actions\AttachUploadedFiles;

$note = $order->notes()->create(['message' => 'Signed delivery slip attached.']);

AttachUploadedFiles::handle($note, $request->file('files'));

$note->attached_files; // Collection of File models

// config/oi-laravel-notes.php
'models' => [
    'note' => App\Models\Note::class, // extends OiLab\OiLaravelNotes\Models\Note
],
bash
php artisan vendor:publish --tag=oi-laravel-notes-migrations
php artisan vendor:publish --tag=oi-laravel-notes-config
php artisan migrate
bash
php artisan oi:skills