skygdi / product-image
There is no license information available for the latest version (dev-master) of this package.
product image
dev-master
2018-05-24 15:40 UTC
Requires
- spatie/laravel-medialibrary: ^7.0.0
This package is not auto-updated.
Last update: 2025-04-27 08:38:49 UTC
README
Quick Product Image class (product id , name and description) base on Spatie\MediaLibrary for Laravel
1.Install:
composer require skygdi/product-image
2.Public migration files:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" php artisan vendor:publish --provider="skygdi\ProductImage\ProductImageProvider"
3.Migrate
php artisan migrate
Change the #order_id input and #order_total value as your logic needed before clicking the paypal checkout button.
4.Usage:
use skygdi\ProductImage\model\ProductImage as ProductImage; //In relation model define: return $this->hasMany('skygdi\ProductImage\model\ProductImage','product_id'); //create ProductImage::create([ "product_id" => 1, "description" => "description", "sort_index" => 1 ]); //Update or add an image: ProductImage::find(1)->UploadImage($request->file('new_image')); //Delete (include image if exist) ProductImage::find(1)->delete(); //Retrieve image URL ProductImage::find(1)->ImageUrl();
5.Testing: The fast test URL: yourUrl/skygdi/pi/test, or you could write on your own.
Route::get('/', function () { //Creating ProductImage::create([ "product_id" => 1, "description" => "description", "sort_index" => 1 ]); */ $pi = ProductImage::find(1); //$pi->UploadImage( storage_path('app/file.jpg') ); //From local file //$pi->UploadImage( $request->file('new_image') ); //From upload form //$pi->UploadImageFromUrl("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"); //From Internet echo "<img src='".url('/').$pi->ImageUrl()."'/>"; });