我有一个模型,用于通过查询从数据库中提取一些数据。我正在尝试缩短存储在其中一列(“描述”)中的文本。这是模型函数:
public static function fan_likes() {
$fan_likes = DB::table('fanartists')
->join('artists', 'fanartists.artist_id', '=', 'artists.id')
->where('fanartists.fan_id', '=', Auth::user()->id)
->select('artists.id', 'artists.stage_name', 'artists.city', 'artists.state', 'artists.image_path', 'artists.description')
->get();
return $fan_likes;
}
您知道在提取此数据时如何将“artists.description”缩短为有限的字符数量吗?谢谢你。