12345678910111213141516171819202122232425262728 |
- <?php
- /**
- * Created by PhpStorm.
- * User: zilongs
- * Date: 20-10-30
- * Time: 下午4:43
- */
- namespace App\Models;
- class UserMessage extends BaseModel
- {
- public static function saveMessage($user_id, $type, $relation_id = 0, $param = [], $content = '')
- {
- if (empty($content)) {
- $content = config('config.user_message_map')[$type] ?? '';
- $content = vsprintf($content, $param);
- }
- UserMessage::create([
- 'user_id' => $user_id,
- 'type' => $type,
- 'relation_id' => $relation_id,
- 'content' => $content,
- ]);
- return true;
- }
- }
|