Answer the question
In order to leave comments, you need to log in
How to extend vendor class in Laravel?
Good evening. I really want to understand the topic of Service Container in Laravel, but after reading the documentation I can’t understand anything.
If someone can help me solve the problem I would be very grateful.
My assignment is this.
There is a project on Laravel 6.0
There is a bumbummen99/shoppingcart package.
The container that is responsible for all the logic of the package is located here vendor\bumbummen99\shoppingcart\src\Cart.php
Inside the file is the following content
<?php
namespace Gloudemans\Shoppingcart;
class Cart
{
const DEFAULT_INSTANCE = 'default';
public function myNewFunction()
{
return 'My Test Function';
}
}
Cart->myNewFunction()
composer update
app\http\binding\
class MyBindingClass extends Cart
{
public function myNewFunction()
{
return 'My Test Function';
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question