PHP code example of fei77 / laravel-helpers
1. Go to this page and download the library: Download fei77/laravel-helpers 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/ */
fei77 / laravel-helpers example snippets
public function store(Request $request)
{
$blog = new Blog();
$blog->user_id = Auth::user()->id;
if ($request->image) {
$image = Helpers::image($request->image)->folder('images/blogs')->encode('jpg', 80)->saveWithThumbnail();
// the image files will be saved inside public/images/blogs
$blog->originalUrl = $image['originalName'];
$blog->previewUrl = $image['thumbnailName'];
}
$blog->fill($request->translations);
$blog->save();
}