1. Go to this page and download the library: Download 0config/file-cabinet 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/ */
// import on top
// use ZeroConfig\FileCabinet\FileCabinet;
public function files()
{
return $this->hasMany(FileCabinet::class);
}
public function filesUser()
{
return $this->hasMany(FileCabinet::class)
->where('model_name', '=', 'User');
}
public function filesFileCabinet()
{
return $this->hasMany(FileCabinet::class)
->where('model_name', '=', 'FileCabinet');
}