我需要在web包上使用外部库和laravel-mix.在网络包上我应该按照webpack文档中的描述做这样的事情
{
output: {
// export itself to a global var
libraryTarget: "var",
// name of the global var: "Foo"
library: "Foo"
},
externals: {
// require("jquery") is external and available
// on the global var jQuery
"jquery": "jQuery"
}
}
Run Code Online (Sandbox Code Playgroud)
但我可以用laravel mix来做到这一点吗?
我的 Laravel 应用程序中出现此错误。
这些是表格:
邮政
Schema::create('posts', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('content');
$table->timestamps();
$table->integer('user_id')->unsigned();
});
Run Code Online (Sandbox Code Playgroud)
类别
Schema::create('categories', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)
Post_Category
Schema::create('post_category', function (Blueprint $table) {
$table->integer('post_id')->unsigned()->unique()->nullable();
$table->integer('cat_id')->unsigned()->unique()->nullable();
$table->timestamps();
});
Run Code Online (Sandbox Code Playgroud)
外键
Schema::table('posts', function (Blueprint $table) {
$table->foreign('id')->references('post_id')->on('post_category')->onDelete('cascade');
});
Schema::table('categories', function (Blueprint $table) {
$table->foreign('id')->references('cat_id')->on('post_category')->onDelete('cascade');
});
Run Code Online (Sandbox Code Playgroud)
这是我的模型
class Categorie extends Model
{
protected $table = 'categories';
public function posts() {
return $this->hasMany('App\PostCategory');
}
}
Run Code Online (Sandbox Code Playgroud)
...
class Post extends Model
{
public function author() {
return …Run Code Online (Sandbox Code Playgroud) 我有两个控制器必须相互通信.第一个引用视频播放器,第二个引用时间线.
从第一个开始,我得到了currentTime视频播放的内容,我希望将其传递给第二个应该在播放视频时移动时间栏的视频.
我尝试使用工厂共享一个time在控制器之间调用的变量,但这在此期间不会改变.
第一控制员:
angular.module('videoCtrl', ['vjs.video'])
.controller('videoController', ['$scope', 'Timeline', function (scope, Timeline) {
scope.mediaToggle = {
sources: [
{
src: 'http://static.videogular.com/assets/videos/videogular.mp4',
type: 'video/mp4'
}
],
};
//listen for when the vjs-media object changes
scope.$on('vjsVideoReady', function (e, videoData) {
videoData.player.on('timeupdate', function () {
var time = this.currentTime();
Timeline.setTime(time); // setting the time on factory
})
});
}]);
Run Code Online (Sandbox Code Playgroud)
第二控制器:
angular.module('timelineCtrl', ['mt.media-timeline'])
.controller('timelineController', function ($scope, Timeline) {
$scope.time = Timeline.getTime(); // here I'm trying to get the …Run Code Online (Sandbox Code Playgroud) angularjs ×1
foreign-keys ×1
laravel ×1
laravel-5 ×1
laravel-5.4 ×1
laravel-mix ×1
mysql ×1
webpack ×1