Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ You can use legacy Magento 2 as the backend (administration panel), and any othe

# History

After the releases of the VueStorefron and Hyva Theme (A brand-new frontend for Magento 2 without reusing Magento UI and using Laravel ecosystem as a base Alpine.JS / Tailwind CSS) everybody understands that the only way to build a good eCommerce Website is not to use M2 broken legacy frontend/backend functionality. I have been using this library for the last 3 years and see only benefits. Even if you need reimplement functionality from scratch it is much faster than reusing Adobe Commerce broken core framework bloatware.
After the releases of the VueStorefront and Hyva Theme (A brand-new frontend for Magento 2 without reusing Magento UI and using Laravel ecosystem as a base Alpine.JS / Tailwind CSS) everybody understands that the only way to build a good eCommerce Website is not to use M2 broken legacy frontend/backend functionality. I have been using this library for the last 3 years and see only benefits. Even if you need reimplement functionality from scratch it is much faster than reusing Adobe Commerce broken core framework bloatware.

**Why Laravel and Eloquent?**

Laravel is the most popular PHP framework. I have used different ORMs and Eloquent is the best.

# Magento ORM Concept

Data is the essence of any web application. Models are the essence of the ORM. A model is an abstraction that represents a magento table in the database. In Larafento, it is a class that extends base Eloquent/Model.
Data is the essence of any web application. Models are the essence of the ORM. A model is an abstraction that represents a magento table in the database. In Laragento, it is a class that extends base Eloquent/Model.

The model tells Eloquent several things about the entity it represents, such as the name of the table in the database and optionally which columns it has (and their data types).

Expand Down Expand Up @@ -122,7 +122,7 @@ To make it simple, we configuration to json and use it and read config.json from
php -r '$x = include("app/etc/env.php"); echo json_encode($x);' > config.json
```

# LAravel Magento with Tinker (REPL)
# Laravel Magento with Tinker (REPL)

Laravel Tinker is a powerful REPL for the Laravel framework, powered by the PsySH package.

Expand Down Expand Up @@ -176,7 +176,7 @@ require __DIR__ . '/vendor/autoload.php';

$orders = Laragento\Models\SalesOrder::whereNull('sync_status')->with('sales_order_items', 'sales_invoices', 'sales_order_payments', 'sales_creditmemos', 'sales_order_addresses', 'sales_shipments', 'customer_entity', 'sales_payment_transactions')->get();

foreach ($oreders as $order) {
foreach ($orders as $order) {
$response = $erp->orderAPI($order->toJson());
if ($response->responseCode === 200) {
$order->sync_status = 'sent_to_erp';
Expand Down Expand Up @@ -243,7 +243,7 @@ require_once __DIR__ . '/autoload.php';
require_once __DIR__ . '/../orm/vendor/autoload.php';

```
Overhead of loading LAravel with 100 product in magento is : 0.0051751136779785 seconds
Overhead of loading Laravel with 100 product in magento is : 0.0051751136779785 seconds
10 products: 0.0026481151580811 seconds.
Just autoload: 0.00015616416931152 seconds.
So, there is no overhead of adding this life hack to Magento. Magento 2 framework is an instinct dinosaur.
Expand Down
2 changes: 0 additions & 2 deletions src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public static function connect(array $params)
$params = array_merge(static::$baseParams, $params);
$capsule->addConnection($params);
$capsule->bootEloquent();

$capsule->bootEloquent();

if(isset($params['events'])) $capsule->setEventDispatcher(new \Illuminate\Events\Dispatcher);

Expand Down