我正在创建一个File Contents
包,初学者
通过Composer
我已将我的包添加到测试应用程序中。
测试应用程序输出应该是Composer
,而是打印视图名称
有什么问题?
DownloadsServiceProvider:
12345
控制器:
class DownloadsServiceProvider extends ServiceProvider
{
public function boot()
{
$this->loadViewsFrom(__DIR__.'/resources/views/download', 'downloads');
public function register()
{
new Routes();
}
}
路线:
namespace xxx\xxx\downloads;
use Illuminate\Http\Request;
class DownloadsController
{
public function index(Request $request)
{
$test='12345';
return View('downloads::test' ,compact('test'));
}
}
查看:
public function registerRoutes()
{
Route::prefix(self::CMSURL)->group(function () {
Route::get(
'/downloads',
function (Request $request) {
//return (new DownloadsController())->index($request)->name(self::DOWNLOADS_LISTER);
return (new DownloadsController())->index($request);
}
);
});
}
输出源:
{{$test}}
12345