xiaohj001

898 经验值

请问老师:关联表的表名的命名有规则吗?比如:permissions表和roles表的关联表名命名为permission_role或role_permission;users表和roles表的关联表名命名为user_role或role_user都可以吗?

我做的明显的改变就是重启了终端和服务

奇怪,找bug找了一上午,都没找出原因,运行也是不对的,刚发帖问了您,再次运行就没问题了。

请问:我在admin注册页面进行注册的时候,数据没有添加到admin表中,却加到users表中,找了好久的原因却没找到。

  • 注册的路由

Route::get('admin/register', 'AdminAuth\AuthController@showRegistrationForm');
Route::post('admin/register', 'AdminAuth\AuthController@register');
  • AuthController.php中的代码

<?php
namespace App\Http\Controllers\AdminAuth;
use App\Admin;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/admin';

    protected $guard = 'admin';

    public function showLoginForm()
    {
        return view('admin.auth.login');
    }

    public function showRegistrationForm()
    {
        return view('admin.auth.register');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'name' => 'required|max:255',
            'email' => 'required|email|max:255|unique:users',
            'password' => 'required|min:6|confirmed',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return Admin
     */
    protected function create(array $data)
    {
        return Admin::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => bcrypt($data['password']),
        ]);
    }
}
  • Admin.php文件的代码

<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class Admin extends Authenticatable
{
    protected $table = 'admin';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];
}
  • register.blade.php文件中做修改的代码

<div class="panel-heading">Admin Register</div>
<form class="form-horizontal" role="form" method="POST" action="{ url('/admin/register') }">
</form>

路由中注册的退出登录的方法名要和AuthController文件中构造函数里面调用的方法名一致

好像是script的原因,我没有引用cdn的

请问:<li @click="toggleTasks(task)" :class="{'completed':task.completed}" v-for="task in list">

            { task.body }
            <strong @click="deleteTask(task)">X</strong>
        </li>

li标签里面的strong标签中的点击事件能执行到吗?不会被li标签的点击事件屏蔽掉吗?