I’m having a problem with Fractal library. I’m using Spatielaravel-fractal library which is just wrapper for Leaguefractal. So… I want to return an empty object instead of an empty array. $this->null() always returns [] after generation and I want to return {}. Tbh I want to have 2 functi…
Spatie/pdf-to-image get number of images always returns 0
I’m using the spatie/pdf-to-image with laravel to create thumbnails of uploaded pdf files. What is weird is that the code was working at one point now it isn’t. $pdf->getNumberOfPages(); always returns 0 no matter how many pages the pdf contains. This is the constructor in the Spatie Pdf class.…
Laravel Nova Card Metrics Auto Update Without Refresh Page
I want to update Laravel Nova Card metrics on specific interval without refreshing page. But without modifying Laravel Nova Core files. Is there any way which makes it easy to do on any Laravel Nova …
SQL-Server Select returning null on PHP
I have a query that returns all the data while running at MSSQL, but when I try to get the result with php code it returns null SELECT: PHP CODE: Answer I’ve found the problem The problem was the encoding, I put the $query inside of utf8_encode(), and now it is returning the results. Thank you all for y…
How to get plain text from html in laravel model?
I’ve a database column named description in which i’ve saved input from tinymce editor. data is something like this, I can easily display the data in view with following, But, I need some processing to get 30 words from text with following code in model, and I’m currently geting empty when I…
How to autoload custom annotation classes without using AnnotationRegistry?
I’m using Doctrine Annotations library (not the whole Doctrine, only annotations) and want to make a custom annotation class. composer.json: index.php: entities/MyClass.php annotations/TestAnnotation.php It gives me the following error: The only solution i found on the Internet is to use AnnotationRegis…
Disable specific cart item quantity fields based on WooCommerce product category
In woocommerce I am using Hide “remove item” from cart for WooCommerce product category answer code and I would like to disable the cart quantity field too, avoiding customer to change the item quantity to zero. Is that possible? Any track on this will be appreciated. Answer The following code will remove the…
Laravel – convert array into eloquent collection
I need to use data from an API. I create a function: and dd($vouchers) return me: Now when I try to use $vouchers array with blade engine like: I got error: How I can convert array into eloquent collection. I use the latest Laravel 5.7 version Answer Actually your $vouchers is an array of arrays, So you may w…
Laravel 5.5 BelongsToMany with pivot conditions
I have three models, Clinic, Department and ClinicDepartment and has belongsToMany relation called departments from Clinic to Department using ClinicDepartment’s table as pivot table, but when i using this relation, scopes from ClinicDepartment not aplying in query. I decided to make Pivot model calling…
Disable only flat rate shipping method when free shipping is available in Woocommerce
I am using Hide specifics Flat Rates when Free Shipping is available in WooCommerce 3 lightly changed answer code to hide all shipping methods except one. The only method I want showing is a rate from the “Woocommerce Advanced Shipping” plugin. I am using the correct rate ID etc… Everything …