понедельник, 11 марта 2024 г.

Adding a Custom Field in Laravel's Scope Without Impacting Other Selections

Somehow I didn’t immediately understand this, but somehow it’s quite simple, but not obvious from the start.  

If you need to add a field in a scope, but in such a way that it does not affect other selections or does not select only this field, you can do this:

 
public static function scopeAddCustom(Builder $query): Builder
{
    return $query->select($query->getQuery()->columns ?? '*')
        ->addSelect(new Expression('TRUE as custom'));
}

вторник, 20 февраля 2024 г.

Microsoft Teams Message Card and Adaptive Cart

I decided to make a post on an old blog to test one theory. I noticed that the page with the project on Github is not in the Google index.

I made a component a while ago for MS Teams Cards. Maybe it will be useful to someone else.

yii2 component for Microsoft Teams Message Card and Adaptive Cart