Laravel和phpStorm集成 - "无法解析目录"

时间:2015-07-16 13:05:48

标签: laravel phpstorm

我正在使用Laravel 5.1,我看了Jeffrey's video关于如何解决外墙问题的问题。现在,一切几乎都很完美。

当我在我的观点上尝试代码时,例如:

<script type="text/javascript" src="assets/js/page.js"></script>

phpStorm将此位置标记为错误,因为他无法解析文件的位置,因为他正在寻找不存在的文件Root/app/resources/views/layouts/assets/js/page.js

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

src="assets/js/page.js"更改为src"{{ asset('assets/js/page.js')}}"

资产功能实际上是一个功能而不是文件夹。我认为它引用了公共文件夹中的预期,但我仍然不是100%!

答案 1 :(得分:0)

使用此代码将为您提供帮助:

import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:renata_osorio_nails/helpers/validators.dart';
import 'package:provider/provider.dart';
import 'package:renata_osorio_nails/models/user_manager.dart';
import 'package:renata_osorio_nails/models/user.dart';

class LoginScreen extends StatelessWidget {

  final TextEditingController emailController = TextEditingController();
  final TextEditingController passController = TextEditingController();
//Controladores de texto

  final GlobalKey<FormState> formKey = GlobalKey<FormState>();
  //Chave de formulário
  final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
//Chave Snackbar

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: scaffoldKey,
      appBar: AppBar(
        title: const Text('Entrar'),
        centerTitle: true,
        actions: [FlatButton(
          onPressed: (){
            Navigator.of(context).pushReplacementNamed('/signup');
          },
          textColor: Colors.white,
          child: const Text('CRIAR CONTA',
          style: TextStyle(fontSize: 14),),
        )],
      ),
      body: Center(
        child: Card(
            margin: const EdgeInsets.symmetric(horizontal: 16),
            child: Form(
              key: formKey,
              child: Consumer<UserManager>(
                builder: (_, userManager, child){
                  return ListView(
                    padding: const EdgeInsets.all(16),
                    shrinkWrap: true,
                    children: [
                      TextFormField(
                        controller: emailController,
                        enabled: !userManager.loading,
                        decoration: const InputDecoration(hintText: 'E-mail'),
                        keyboardType: TextInputType.emailAddress,
                        autocorrect: false,
                        validator: (email) {
                          if(!emailValid(email))
                            return 'E-mail inválido';
                          return null;
                        },
                      ),
                      const SizedBox(
                        height: 16,
                      ),
                      TextFormField(
                        controller: passController,
                        enabled: !userManager.loading,
                        decoration: const InputDecoration(hintText: 'Senha'),
                        autocorrect: false,
                        obscureText: true,
                        validator: (pass) {
                          if (pass.isEmpty || pass.length < 8)
                            return 'Senha inválida';
                          return null;
                        },
                      ),
                      Align(
                        alignment: Alignment.centerRight,
                        child: FlatButton(
                          onPressed: () {},
                          padding: EdgeInsets.zero,
                          child: const Text('Esqueci minha senha'),
                        ),
                      ),
                      const SizedBox(
                        height: 16,
                      ),
                      SizedBox(
                        height: 44,
                        child: RaisedButton(
                          onPressed: userManager.loading ? null : () {
                            if(formKey.currentState.validate()){
                              context.read()<UserManager>().signIn(
                                  user: AppUser(
                                    email: emailController.text,
                                    password: passController.text,
                                  ),
                                  onFail: (e){
                                    scaffoldKey.currentState.showSnackBar(
                                        SnackBar(
                                          content: Text ('Falha ao entrar: $e'),
                                          backgroundColor: Colors.red,
                                        )
                                    );
                                  },
                                  onSuccess: (){
                                    //TODO: Fechar a tela de login
                                  }
                              );}},
                          color: Theme.of(context).primaryColor,
                          disabledColor: Theme.of(context).primaryColor.
                              withAlpha(100),
                          textColor: Colors.white,
                          child: userManager.loading ?
                          CircularProgressIndicator(
                            valueColor: AlwaysStoppedAnimation(Colors.white),
                          ) :
                          const Text(
                            'Entrar',
                            style: TextStyle(fontSize: 18),
                          ),
                        ),
                      ),
                    ],
                  );
                },
              ),
            )),
      ),
    );
  }
}