PHP code example of benbjurstrom / glint
1. Go to this page and download the library: Download benbjurstrom/glint 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/ */
benbjurstrom / glint example snippets
public function store(Request $request)
{
Gate::authorize('uploadImages', [
$request->user()
]);
$data = $request->validate([
'type_id' => '$model = (new $modelName)->findOrFail($data['model_id']);
throw_unless($model instanceof HasImagesInterface,
\Exception::class, 'Model does not implement HasImagesInterface'
);
$type = ImageType::findOrFail($data['type_id']);
$image = $model->addImageFromDraft($type);
return response()->json($image);
}
bash
php artisan vendor:publish --tag="glint-migrations"
php artisan migrate