Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PetroGromovo's avatar

How better to filter data which were read with curl ?

Hello, In my new Laravel 5.8 app I read data from external source using curl which has some filters. I need more filters applied and to save filtered rows in db. My question is how better to filter data which were read with curl.

First idea to save all data in temp table with session_unique_id field as system is multiuser and apply filters on these data. The thing is that there more 10 filters in the system and using scopes I can controle filteres like:

    public function scopeGetByVote($query, $vote_id= null)
    {
        if (!empty($vote_id)) {
            if ( is_array($vote_id) ) {
                $query->whereIn( with(new VoteItem)->getTable().'.vote_id', $vote_id );
            } else {
                $query->where( with(new VoteItem)->getTable() . '.vote_id', $vote_id );
            }
        }
        return $query;
    }

as some filters can be selected, but some not.

Has Laravel 5.8 some better tools for rows filtering without writing data to temp tables? Are there some better tools from point of productivity? That is multiusers system and can have quite a lot of requests...

Thanks!

0 likes
3 replies
PetroGromovo's avatar

Searching I found using of temporary table in laravel, like https://stackoverflow.com/questions/42555512/how-to-create-temporary-table-in-laravel and https://laracasts.com/discuss/channels/laravel/how-to-implement-temporary-table . which are session based. I want take advantage of filters for Model, Which I will create for this temporary tanle. That looks like what I need, but is it ok for my task. I hope I explained clearly what I need. Has laravel some better tools for it? Who worked with it?

Please or to participate in this conversation.