app/Http/Controllers/CurdController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $data = $request->all();
        获取用户guid
        $guid = self::$user->getGuid(['email' => $data['email']])->gu_id;
        $id = Uuid::uuid1()->getHex();
        $result = [
            'id' => $id,
            'user_guid' => $guid,
            'title' => $data['title'],
            'category' => $data['category'],
            'content' => $data['content'],
            'published_at' => time()
        ];
        if(self::$article->addArticle($result)){
         return '发布成功<a href="/user">返回个人中心</a>';
        }else{
            return '发布失败<a href="/curd/create">点击返回发布页</a>';
        };
    }
public function store ( Request $ request ) { $ data = $ request -> all ( ) ; $ guid = self :: $ user -> getGuid ( [ 'email' => $ data [ 'email' ] ] ) -> gu_id ; $ id = Uuid :: uuid1 ( ) -> getHex ( ) ; $ result = [ 'id' => $ id , 'user_guid' => $ guid , 'title' => $ data [ 'title' ] , 'category' => $ data [ 'category' ] , 'content' => $ data [ 'content' ] , 'published_at' => time ( ) ] ; if ( self :: $ article -> addArticle ( $ result ) ) { return '发布成功<a href="/user">返回个人中心</a>'; } else { return '发布失败<a href="/curd/create">点击返回发布页</a>'; } ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// //获取用户guid