canihelpyou

662 经验值

自带的auth()方法是在这个控制器里面:

\vendor\laravel\framework\src\Illuminate\Routing\Router.php

因为需要在auth()里面增加一些路由,所以重写它,可是在什么地方重写呢?直接在vendor文件夹改的话每次composer update都会被重置成原来的样子。

env文件中,默认是这样:

APP_ENV=local

除了local,还可以改成什么?

视频是另外单独存放的么?云主机用的多少钱的?

站主你这个站用的云主机带宽是多少?

使用ueditor的时候要防止xss攻击吗?
《开发知乎》里面讲ueditor的时候好像没说这个。

我想发送一个ajax请求检测用户是否登录,如果没有登录就跳转到登录页面,怎么写才可以?

 axios.get('/check-login')
       .then(response => {
              this.dialogFormVisible = true; //如果登录就执行这个语句
          })
         .catch(error => {
              location.href = "/login";  //如果登录就执行跳转到登录页
});

控制器CheckController.php

    public function checkLogin()
    {
        $status=Auth::check();
        return $status;
    }
<div class="container" id="app">
    <div class="card">
        <h3 class="card-header">Todos 数量:  todoCount  </h3>
        <div class="card-block">
            <todo-items :todos="todos"></todo-items>
        </div>
        <div class="card-block">
            <todo-form :todos="todos"></todo-form>
        </div>
    </div>

</div>

<script type="text/x-template" id="todo-items-template">
    <ul class="list-group">
        <li class="list-group-item" v-bind:class="{ 'completed': todo.completed }" v-for="(todo,index) in todos">
              todo.title  
            <button type="button" class="btn btn-sm" v-bind:class="[todo.completed ? 'btn-success': 'btn-danger']" v-on:click="toggleCompletion(todo)">  todo.completed ? 'completed': 'undo'  </button>
            <button type="button" class="btn btn-warning btn-sm"  v-on:click="deleteTodo(index)">删除</button>
        </li>
    </ul>
</script>

<script type="text/x-template" id="todo-add-form-template">
    <form v-on:submit.prevent="addTodo(newTodo)">
        <div class="form-group row">
            <label for="input1" class="col-sm-2 col-form-label">输入内容</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="input1" v-model="newTodo.title">
            </div>
        </div>
        <div class="form-group row">
            <div class="offset-sm-2 col-sm-10">
                <button type="submit" class="btn btn-primary">提交</button>
            </div>
        </div>
    </form>
</script>

<script>
    Vue.component('todo-items',{
        template:"#todo-items-template",
        props:['todos'],
        methods:{
            deleteTodo(index){
                this.todos.splice(index,1);
            },
            toggleCompletion(todo){
                todo.completed = !todo.completed
            }
        }
    });

    Vue.component('todo-form',{
        template:"#todo-add-form-template",
        props:['todos'],
        data(){
            return{
                newTodo: {id:null,title:'',completed:false}
            }
        },
        methods:{
            addTodo(newTodo){
                this.todos.push(newTodo);
                this.newTodo={id:null,title:''};
            }
        }
    });

    new Vue({
        el: "#app",
        data:{
            todos:[
                {id:1,title:'learn vue.js 2.0',completed:false}
            ]
        },
        computed:{
            todoCount(){
                return this.todos.length;
            }
        }
    });
</script>

问题:
props:['todos']中的todos对应的下面两个标签中的:todos="todos",是对应等号前面的todos还是后面的?

<todo-items :todos="todos"></todo-items>
<todo-form :todos="todos"></todo-form>