1
我有一个电影台和流派表,我说我的关系如下图所示许多在laravel许多关系4
public function genres()
{
return $this->belongsToMany('Genre');
}
和类型模型
public function movies()
{
return $this->belongsToMany('Movie');
}
,这是多么我控制器看起来像但是当我尝试上传电影时,电影上传成功但它返回下面显示的错误
$movie = new Movie();
$movie->status_id = Input::get('status');
$movie->title = Input::get('title');
$movie->summary = Input::get('summary');
$movie->duration = Input::get('duration');
$movie->cast = Input::get('cast_list');
$movie->director = Input::get('director');
$movie->price = Input::get('movie_price');
$movie->dimension = Input::get('dimension');
$movie->time_showing = Input::get('time_showing');
$movie->time_showing1 = Input::get('time_showing1');
$movie->photo = $photoname;
$movie->date_showing = Input::get('date_showing');
$movie->save();
$movie->genres()->sync(Input::get('genre'));
return Redirect::back()->with('success', 'movie added successfully');
这是传递给 照亮\数据库错误
参数1 \雄辩\关系\ BelongsToMany :: formatSyncList() 的类型必须为阵,给定的字符串,称为 电子商务:\电影\供应商\ laravel \框架的\ src \照亮\数据库\雄辩\关系\ BelongsToMany.php 上线599和定义
任何人谁可以给我一只手,我将不胜感激谢谢。
非常感谢你Ciccio它的工作 – Tongi
[很高兴帮忙](http://stackoverflow.com/help/someone-answers) –