Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
laravel 5和mysql关系SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败_Mysql_Laravel 5_Foreign Key Relationship - Fatal编程技术网

laravel 5和mysql关系SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败

laravel 5和mysql关系SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败,mysql,laravel-5,foreign-key-relationship,Mysql,Laravel 5,Foreign Key Relationship,我试图将值插入到我的服务表中,但遇到了一个错误。它说我不能添加或更新子行。 信息: SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败(adrenalineservices,constraintservices\u id\u produit\u foreign外键(id\u produit)引用produits(id\u produit)(SQL:在服务中插入值(sqslqslk,2016-04-11 21:02:352016-04-11 21:02:35)

我试图将值插入到我的服务表中,但遇到了一个错误。它说我不能添加或更新子行。 信息: SQLSTATE[23000]:完整性约束冲突:1452无法添加或更新子行:外键约束失败(
adrenaline
services
,constraint
services\u id\u produit\u foreign
外键(
id\u produit
)引用
produits
id\u produit
)(SQL:在
服务中插入
值(sqslqslk,2016-04-11 21:02:352016-04-11 21:02:35)
我的控制器

   public function create()
 {
   return view('services'); 
 }

/**
 * Store a newly created resource in storage.
 *
 * @return Response
 */
public function store(serviceRequest $request)
{
    $input=$request->all();
   // dd($input);
   \App\Service::create($input);
}
我的看法

@extends('layouts.app')

@section('content')
<div class="container">
<div class="row">
    <div class="col-md-10 col-md-offset-1">
        <div class="panel panel-default">
            <div class="panel-heading">Ajouter une service</div>

            <div class="panel-body">
                {!! Form::open(['url'=>'service/store']) !!}
                <div class="form-group">
                        {!! Form::label('titre', 'Titre:') !!}
                        {!! Form::text('titre',null) !!}
                </div>
                <div class="form-group">
                        {!! Form::label('produit', 'Id produit:') !!}
                        {{ Form::input('number', 'produit',null) }}
                </div>
                <div class="form-group">
                        {!! Form::label('axe_p', 'Id axe principale:') !!}
                        {{ Form::input('number', 'axe_p') }}
                </div>
                <div class="form-group">
                {!! Form::label('description', 'Description:') !!}

               {!! Form::textarea('description',null) !!}
                </div>
                <div class="form-group">
                        {!! Form::submit('Nouveau service') !!}
                </div>

            {!! Form::close() !!}
            </div>
         </div>
       </div>
       </div>
       </div>
     @endsection
@extends('layouts.app'))
@节(“内容”)
Ajune服务
{!!Form::open(['url'=>'service/store'])
{!!Form::label('titre','titre:')
{!!Form::text('titre',null)
{!!Form::label('produit','Id produit:')
{{Form::input('number','produit',null)}
{!!Form::label('axe_p','Id axe principale:')
{{Form::input('number','axe_p')}
{!!Form::label('description','description:')
{!!Form::textarea('description',null)!!}
{!!表单::提交('Nouveau service')
{!!Form::close()!!}
@端部