PHP code example of codebuglab / laravel-media-removable
1. Go to this page and download the library: Download codebuglab/laravel-media-removable 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/ */
codebuglab / laravel-media-removable example snippets
use CodeBugLab\MediaRemovable\MediaRemovable;
class MyModel extends Eloquent
{
use MediaRemovable;
private static $mediaFields = ['image']; //image is column_name you want to delete
}
use CodeBugLab\MediaRemovable\MediaRemovable;
class MyModel extends Eloquent
{
use MediaRemovable;
private static $mediaFields = ['image']; //image is column_name you want to delete
private static $mediaPath = "storage/app/public/"; //The path of you media files
}
use CodeBugLab\MediaRemovable\MediaRemovable;
class MyModel extends Eloquent
{
use MediaRemovable;
// set all columns and paths for this model
public static $mediaDetails = [
[
'field' => 'image',
'path' => 'storage/app/public/images/'
],
[
'field' => 'profile_picture',
'path' => 'storage/app/public/profile/'
],
];
}
use CodeBugLab\MediaRemovable\MediaRemovable;
class MyModel extends Eloquent
{
use MediaRemovable;
}