public function onSubmitMsg() { $user_id = intval(post('user_id')); $content = post('content'); $imsg = \RainLab\Blog\Models\IMsg::insertGetId(['user_id' => $user_id, 'content' => $content, 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]); return ['id' => $imsg]; }
public function run() { // // @todo // // Add a Welcome post or something // Category::create(['name' => trans('rainlab.blog::lang.categories.uncategorized'), 'slug' => 'uncategorized']); IMsg::create(['user_id' => User::orderBy('id', 'desc')->first()->id, 'content' => '初始化信息第一条']); }