1. Go to this page and download the library: Download esign/laravel-model-files 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/ */
esign / laravel-model-files example snippets
use Esign\ModelFiles\Concerns\HasFiles;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasFiles;
}
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->boolean('file')->default(0);
$table->string('file_filename')->nullable();
$table->string('file_mime')->nullable();
});
use Esign\ModelFiles\Concerns\HasFiles;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use HasFiles;
public function getFileDisk(): string
{
return 'public';
}
}
use Esign\ModelFiles\Concerns\HasFiles;
use Esign\UnderscoreTranslatable\UnderscoreTranslatable;
use Illuminate\Database\Eloquent\Model;
class UnderscoreTranslatablePost extends Model
{
use HasFiles;
use UnderscoreTranslatable;
public $translatable = [
'document',
'document_filename',
'document_mime',
];
}