PHP code example of irishtitan / handshake

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

    

irishtitan / handshake example snippets



use Magento\Catalog\Model\ProductFactory;
use IrishTitan\Handshake\Core\App;
 
$productFactory = App::make(ProductFactory::class);


$product = Product::find(23);

$product = Product::whereSku('PROD0001');

$products = Product::all();

$product = Product::find(123);

$product->addImage('path/to/first/image.jpg');
$product->addImage('path/to/second/image.jpg');

Product::find(123)
    ->addImage('path/to/first/image.jpg')
    ->addImage('path/to/second/image.jpg');

$product = Product::whereSku('PROD0002');
$images = $product->images();

$product = Product::find(487);
$categories = $product->categories();

$bmw = Product::create([
    'name' => 'BMW',
    'sku' => 'BMW0001',
    'url_key' => 'bmw0001',
    'price' => 65000
]);

$category = Category::find(2);
$product = Product::find(13);

$product->assignToCategory($category);

$category = Category::find(12);

$category = Category::whereUrlKey('shoes');

$category = Category::whereName('Shoes');

$categories = Category::all();

$nike = Product::whereSku('NIKE0001');

$category = Category::whereUrlKey('shoes');
$category->addProduct($nike);

$cars = Category::whereUrlKey('cars');
$bmws = Category::whereUrlKey('bmws');

$bmws->setParent($cars);
$bmws->save();

/**
 * The command syntax.
 *
 * @var string
 */
protected $signature = 'forum:threads:import';

/**
 * The arguments the command accepts.
 *
 * @var array
 */
protected $arguments = [
 
    'thread' => [
        'mode' => '