2017 © Pedro Peláez
 

library product-image

product image

image

skygdi/product-image

product image

  • Thursday, May 24, 2018
  • by skygdi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 25 % Grown

The README.md

Quick Product Image class (product id , name and description) base on Spatie\MediaLibrary for Laravel

1.Install:, (*1)

composer require skygdi/product-image

2.Public migration files:, (*2)

php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider"
php artisan vendor:publish --provider="skygdi\ProductImage\ProductImageProvider"

3.Migrate, (*3)

php artisan migrate

Change the #order_id input and #order_total value as your logic needed before clicking the paypal checkout button., (*4)

4.Usage:, (*5)

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., (*6)

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()."'/>";
});

The Versions

24/05 2018

dev-master

9999999-dev

product image

  Sources   Download

The Requires

 

by Peter