PHP code example of raadaa-partners / raadaa-base

1. Go to this page and download the library: Download raadaa-partners/raadaa-base 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/ */

    

raadaa-partners / raadaa-base example snippets


$uploader = new UploadHelper();

$response = $uploader->uploadFile($request->file('file_key'), 'folder_to_store_image');
if ($response['success']) {
     Blog::create([ 
        'title' => 'Welcome here', 
        'image' => $response['upload_url'],
     ]);
}

$user = User::find($id);
$response = $uploader->uploadOrReplaceFile($request->file('file_key'), 'folder_to_store_image', $user, 'image');
if ($response['success']) {
     $user->image = $response['upload_url'];
     $user->save();
}

$response = $uploader->deleteFile('path_to_uploaded_file_from_associated_table_column');
if ($response['success']) {
    // do something when image is deleted successfully
}