You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
<?php
...
use App\Repositories\ProductRepository;
class ProductService
{
private $product_repository;
public function __construct(ProductRepository $product_repository)
{
$this->product_repository = $product_repository;
}
public function destroy($id)
{
DB::enableQueryLog();
# your laravel query builder goes here
$result = $this->product_repository->delete($id);
$laQuery = DB::getQueryLog();
$lcWhatYouWant = $laQuery[0]['query']; # <-------
dd($lcWhatYouWant);
# optionally disable the query log:
DB::disableQueryLog();
}
}
My repository like this :
<?php
...
use App\Models\Product;
use Illuminate\Contracts\Container\Container;
use Rinvex\Repository\Repositories\EloquentRepository;
class ProductRepository extends EloquentRepository
{
public function __construct(Container $container)
{
$this->setContainer($container)
->setModel(Product::class)
->setRepositoryId('rinvex.repository.uniqueid');
}
}
On the service, I try like that. I want to debug the query to get the error. But there is no error
My service to delete product id like this :
My repository like this :
On the service, I try like that. I want to debug the query to get the error. But there is no error
The result of
dd($lcWhatYouWant);
not displayHow to get the query executed?
I get reference to debug the query from here : https://stackoverflow.com/questions/27753868/how-to-get-the-query-executed-in-laravel-5-dbgetquerylog-returning-empty-arr
I try like that, but it does not work
Seems the debug query on this repository is different
@Omranic, Seems you can help me
The text was updated successfully, but these errors were encountered: