我尝试创建一个程序包,但是由于某种原因,我无法访问前端。 这是我的程序包结构,来自项目根目录:
/package/contact/src/routes/web.php
/package/contact/composer.json
/package/contact/ContactServiceProvider
服务提供者类如下所示:
namespace Sidneylab\Contact;
use Illuminate\Support\ServiceProvider;
class ContactServiceProvider extends ServiceProvider
{
public function boot(){
$this->loadRoutesFrom(__DIR__.'/routes/web.php');
}
public function register(){
}
}
Composer.json
"name": "sidneylab/contact",
"description": "This will send email to admin and send contact query to database",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Sidney de Sousa",
"email": "esp.sousa@gmail.com"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {
"Sidneylab\\Contact\\": "src/"
}
},
web.php
Route::get('contact', function(){
return "contact";
});
在我的主要composer.json文件中,添加了以下内容:
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/",
"Sidneylab\\Contact\\": "package/contact/src"
}
},
此外,我在confi / app.php中导入了服务提供商
Sidneylab\Contact\ContactServiceProvider::class
现在,当我点击我的网址/联系人时,它不会返回任何内容。我有什么想念的吗?
与我命名的东西有关系吗?