PHP code example of daycode / stup-images

1. Go to this page and download the library: Download daycode/stup-images 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/ */

    

daycode / stup-images example snippets


use Daycode\StupImage\Stupable;

public function store(Request $request): RedirectResponse
{
    User::create(... + [
        'thumbnail' => $this->uploadFile($request->file('thumbnail'), 'images/thumbnail'),
    ]);

    return redirect()->back()->with('success', 'User Successfully Created');
}

public function update(Request $request, $id): RedirectResponse
{
    $user = User::findOrFail($id);
    $user->update(... + [
        'thumbnail' => !empty($request->thumbnail)
            ? $this->syncUploadFile($request->file('thumbnail'), $user->thumbnail, 'images/thumbnail')
            : $user->thumbnail,
    ]);

    return redirect()->back()->with('success', 'User Successfully Updated');
}
bash
composer dump-autoload && php artisan optimize:clear
bash
php artisan storage:link