墨生人

2039 经验值

现在好了,我删掉重新复制了一遍,就好了,不知道什么情况,可能是缓存

<?php
/**
 * Created by PhpStorm.
 * User: zhoujie
 * Date: 16/10/30
 * Time: 下午11:03
 */
namespace App\Http\Controllers\Test;

use App\Http\Controllers\BaseController;
use App\Models\Test;

class TestUpdateController extends BaseController
{
    public function __construct()
    {
        parent::__construct();
    }

    public function create()
    {
        $param = $this->validate_process();
        $id = Test::insertGetId($param);
        reset($param); $param['id'] = $id;
        return $id ? response()->json($param) : $this->errorOutput('CREATE_FAILD');
    }

    public function update()
    {
        $this->validation(['id' => 'required|numeric'], ['id' => '测试id']);
        $param = $this->validate_process();
        $id = intval($this->input['id']);
        $res = Test::where('id', $id)->update($param);
        return $res ? response()->json(['success' => 1]) : $this->errorOutput('UPDATE_FAILD');
    }

    public function delete()
    {
        $this->validation(['id' => 'required|numeric'], ['id' => '测试id']);
        $id = intval($this->input['id']);
        $res = Test::destroy($id);
        return $res ? response()->json(['success' => 1]) : $this->errorOutput('DELETE_FAILD');
    }

    private function validate_process()
    {
        $rules = [
            'name'     => 'required|unique:mysql-i.users|alpha_dash|max:32',
            'password' => 'required|alpha_dash|min:6|max:32',
            'tel'      => 'required|digits_between:3, 18',
            'email'    => 'required|email|min:3|max:32',
            'avatar'   => 'min:3'
        ];
        $attr = [
            'name'     => '用户名',
            'password' => '用户密码',
            'tel'      => '用户电话',
            'email'    => '用户邮箱',
            'avatar'   => '用户头像',
        ];
        if (!empty($this->input['id'])) { $rules['name'] = 'required|alpha_dash|max:32'; }
        $this->validation($rules, $attr);
        return [
            'name'     => trim($this->input['name']),
            'password' => trim($this->input['password']),
            'tel'      => trim($this->input['tel']),
            'email'    => trim($this->input['email']),
            'avatar'   => $this->input['avatar'] ? serialize($this->input['avatar']) : '',
            'create_time' => TIMENOW
        ];
    }
}

大神,我创建了2个控制器一个是TestController,一个是TestUpdateController,都继承Controller,使用的是同一个Test Model,但是TestController里面的方法配置路由都能正常访问,但是TestUpdateController里面的方法都会报这个错
Target [App\Http\Controllers\Test\TestUpdateController] is not instantiable,不知道是什么原因,网上找不到答案

厉害哦,简单明了,虽然还没讲解深入,但是真的是很好的视频

大神,问下mac上面nginx+mysql+php php5.6升级php7.0有需要注意的地方吗,或者有教程吗

神,能帮我改个用户名吗,改成“墨生人”和昵称一样就OK了