Блог очередного разработчика

Sanasol

VueJS/Laravel + Quill Editor handling base64 image upload

Hello,

Quill editor doing really great job with accepting images and putting it as base64.

But actually it doesnt good, especially for big images.

Your DB will be big AF and page load time will grow with each image in text.

I didnt find good or working solution from Quill side. Only some closed GitHub issues.

 

So i decided to make lilttle hack on backend.

My system info: VueJS Quill wrapper, Laravel 5.4

Now what we need.

Firstly install Symfony Dow Crawler

Then include it and some other classes in your model/controller.

And here code of extractor/file saver

And finally we got $desc html with converted base64 -> fs path

Saving to DB.

That’s all.

 

Full Code at gist: https://gist.github.com/S-anasol/5dde48f75a265d21123d0ab1f49d2e8a

Laravel 5.2 + JWT + Dingo API + PHPUnit

The token could not be parsed from the request
The token could not be parsed from the request

The token could not be parsed from the request

For some magic reasons(simulating requests) phpunit can’t pass tests with JWT token header or GET param token=?.

Solution is just add few lines to middleware or anywhere else like this.

Got it work with this code in my middleware:

Result middleware for api auth

Result :)
Result 🙂

Eloquent query logging outside Laravel

Class db does not exist eloquent

A facade root has not been set

and other terrible errors.

This post for those who like me using Eloquent outside Laravel.
With config like this:

Sometime need to log queries or just count it.
Almost all google results show code like this:

But outside Laravel you will get errors written above.

I spent some time to get it work.
And now i got solution 😀

To get work query logs outside Laravel use this 🙂