1. Go to this page and download the library: Download djurovicigoor/lara-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/ */
return [
/*
|--------------------------------------------------------------------------
| Default disk
|--------------------------------------------------------------------------
|
| The disk on which to store added files by default. Choose
| one of the disks you've configured in config/filesystems.php.
*/
'default_disk' => env('LARA_FILE_DISK', 'public'),
/*
|--------------------------------------------------------------------------
| Default visibility
|--------------------------------------------------------------------------
|
| public => Files are accessible through browser
| private => Files are not accessible through browser
*/
'visibility' => env('LARA_FILE_VISIBILITY', 'public'),
/*
|--------------------------------------------------------------------------
| Type of files - relations
|--------------------------------------------------------------------------
*/
'types' => [
'file', 'avatar', 'thumbnail',
],
];
/*
|--------------------------------------------------------------------------
| Type of files - relations
|--------------------------------------------------------------------------
*/
'types' => [
'file', 'avatar', 'thumbnail',
],
$laraFile->hasCustomProperty('author'); // returns true
$laraFile->getCustomProperty('author'); // returns 'John Doe'
$laraFile->hasCustomProperty('does not exist'); // returns false
$laraFile->getCustomProperty('does not exist'); // returns null
$laraFile->setCustomProperty('name', 'value'); // adds a new custom property
$laraFile->forgetCustomProperty('name'); // removes a custom property
$laraFile = LaraFile::find($id);
$laraFile->setCustomProperty('name', 'value'); // adds a new custom property or updates an existing one
$laraFile->forgetCustomProperty('name'); // removes a custom property
$laraFile->save();