【发布时间】:2022-09-30 22:54:27
【问题描述】:
我想根据 Laravel Query 中的特定字符(例如 \"-\"、\":\"、\";\")修剪字符串。
$users = User::select(\"USERID as id\", DB::raw(\"CONCAT(CONCAT(NAME, \' - \'), CONCAT(CONCAT(NUMBER, \' - \'), ROLE)) as text\"))
->whereNotNull(\'name\')
->orderBy(\'name\');
当有特殊字符时,我希望号码被删减
号码示例:123456:9
预计数量:123456
用户选择的结果将是:John Doe - 123456 - 管理员