chagouani

chagouani

Member Since 9 Months Ago

Experience Points 4,480
Experience
Level
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Answer
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • Chatty Cathy Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

20 Sep
2 months ago

chagouani started a new conversation Validateur

I have in my function to check if 'tarificationtache' of 'technicien' exist or not if i have the "tarificationtache" exists for this "technician" so it displays an error message in the same interface My function store is functional but it displays a message in another interface how can I do it with ajax

store function

public function store(Request $request)
{
    $count = tarificationtache::where('technicien_id', $request->input('technicien_id'))
        ->where('tache_id', $request->input('tache_id'))
        ->count();
    if ($count > 0) {
        // TODO: adjust response according to your need
        
        return response()->json(['error' => "Ce technicien a cette tarification"], 400);
    } else {
        $tarification = new tarificationtache;    
        $tarification->tache_id = $request->input('tache_id');
        $tarification->Tarif = $request->input('Tarif');
        $tarification->technicien_id = $request->input('technicien_id');
        $tarification->save();
        // TODO: adjust response according to your need
         return redirect('technicien');
    }
}

** view**

 @extends('Layouts/app')
 @extends('Layouts.master')
 @section('content')
 @if(count($errors))
   <div class="alert alert-danger" role="alert">
   <ul>
    @foreach($errors ->all() as $message)
     <li>{{$message}}</li>
        @endforeach
   </ul>
  </div>
  @endif
   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>



    <script type="text/javascript">

    var getMetiersByTechnicienUrl = "{{url('/metiersbytechnicien')}}";
    var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
    //console.log(getMetiersByTechnicienUrl,getTachesByMetierUrl, 
    getTarificationsByTacheUrl);
    function getMetiersByTechnicien(val) {
        if(val.length>0) {
            var technicien_id = val;
            $.get(getMetiersByTechnicienUrl+'/'+technicien_id,function(res) {
                var html = '<option value=">-Select-"</option>' ;
                $.each(res.metiers,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_metier+'</option>';
                });
                $('#metiers').html(html);

            });
        }
    }

   


    function getTachesByMetier(val) {
        if(val.length>0) {
            var metier_id = val;
            $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.taches,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_tache+'</option>';
                });
                $('#taches').html(html);

            });
        }
    }
    
    </script>
    <div class="container">
    <div class="row"></div>
    <div class="col-md-12">
       
       <div class="col-md-10">
            <h1>Tarification tache</h1>
        <form action=" {{url ('tarification')  }}" method="post">
         {{csrf_field()}}

        <div class="form-group">
            <label for="technicien">Technicien</label>
               <select onchange="getMetiersByTechnicien(this.value)" name="technicien_id" 
               id="technicien_id" class="form-control">
                       <option value="">-Select-</option>
                       @foreach($technicien as $t)
                              <option value="{{$t->id }}" {{ $t->id == $technicien_id ? 'selected = "selected"' 
                               : '' }}>
                                    {{$t->user->nom}}
                              </option>
                       @endforeach
                </select>
        </div>
        <div class="form-group">
            <div class="col-md-12">
                    <div class="col-md-4">
   <label>Metier: </label>
   <select onchange="getTachesByMetier(this.value)" style="width: 
   200px" class="productm form-control" id="metiers">
    <option value="">-Select-</option>
  @foreach($metiers as $metier)
       <option value={{$metier->id}}>{{$metier->libelle_metier}}</option>
  @endforeach
  </select>
        </div>
                    <div class="col-md-4">
                        <label>tache: </label>
                        <select style="width: 200px" class="productname form-control" 
  name="tache_id" id="taches">
                            <option value="">-Select-</option>
                        </select>
                    </div>
                    <div class="col-md-4">
                        <label>tarification: </label>
                        <input style="width: 200px" class="productname form-control" type="text"  
   name ="Tarif" class="form-control" value="{{old('tarif')}}">
                           
                        
                    </div>


                </div>
                </div>
                <div class="form-group">
                <input type="submit" value = "enregistrer" class="form-control btn btn-primary">
            </div>
            </div>
                </div>
            </div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap- 
datepicker.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap- 
datepicker.js"></script>
@endsection
13 Sep
3 months ago

chagouani left a reply on How To Shown Message Erreur On Popup

<div class="container">
    <div class="row"></div>
    <div class="col-md-12">
       
       <div class="col-md-10">
            <h1>Tarification tache</h1>
        <form action=" {{url ('tarification')  }}" method="post">
         {{csrf_field()}}

        <div class="form-group">
            <label for="technicien">Technicien</label>
               <select onchange="getMetiersByTechnicien(this.value)" name="technicien_id" 
  id="technicien_id" class="form-control">
                       <option value="">-Select-</option>
                       @foreach($technicien as $t)
                              <option value="{{$t->id }}" {{ $t->id == $technicien_id ? 'selected = 
  "selected"' : '' }}>
                                    {{$t->user->nom}}
                              </option>
                       @endforeach
                </select>
        </div>
        <div class="form-group">
            <div class="col-md-12">
                    <div class="col-md-4">
<label>Metier: </label>
 <select onchange="getTachesByMetier(this.value)" style="width: 
 200px" class="productm form-control" id="metiers">
    <option value="">-Select-</option>
 @foreach($metiers as $metier)
      <option value={{$metier->id}}>{{$metier->libelle_metier}}</option>
 @endforeach
 </select>
        </div>
                    <div class="col-md-4">
                        <label>tache: </label>
                        <select style="width: 200px" class="productname form-control" 
    name="tache_id" id="taches">
                            <option value="">-Select-</option>
                        </select>
                    </div>
                    <div class="col-md-4">
                        <label>tarification: </label>
                        <input style="width: 200px" class="productname form-control" 
     type="text"  name ="Tarif" class="form-control" value="{{old('tarif')}}">
                           
                        
                    </div>


                </div>
                </div>
                <div class="form-group">
                <input type="submit" value = "enregistrer" class="form-control btn btn-      
      primary">
            </div>
            </div>
                </div>
            </div>

chagouani started a new conversation How To Shown Message Erreur On Popup

Each technician have just one 'Tarification' for a specific 'tache' i made a condition if the 'tarification' exists it return an error message but in another page I would display it in the same on a popup

 public function store(Request $request)
{
    $count = tarificationtache::where('technicien_id', $request->input('technicien_id'))
        ->where('tache_id', $request->input('tache_id'))
        ->count();
    if ($count > 0) {
        // TODO: adjust response according to your need
        
        return response()->json(['error' => "Ce technicien a cette tarification"], 400);
    } else {
        $tarification = new tarificationtache;    
        $tarification->tache_id = $request->input('tache_id');
        $tarification->Tarif = $request->input('Tarif');
        $tarification->technicien_id = $request->input('technicien_id');
        $tarification->save();
        // TODO: adjust response according to your need
         return redirect('technicien');
    }
}
31 Aug
3 months ago

chagouani left a reply on Display Table From Select Box

and on tache controller i have

 public function getTachesByMetier($metier_id)
{
    $t = Metier::find($metier_id);
    return response()->json(['taches' => $t->taches]);
}

and on tarificationcontroller i have

 public function getTarificationsByTache($tache_id)
{
    $t =tache::find($tache_id);
    return response()->json(['tarifications' => $t->tarificationtache]);
}

chagouani left a reply on Display Table From Select Box

@ardnor

    var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
    var getAdresseByClientUrl = "{{url('/adressebyclient')}}";
    var getTarificationsByTacheUrl = "{{url('/tarificationsbytache')}}";
    var getTechniciensByTarificationtacheUrl = "{{url('/techniciensbytarificationtache')}}";
    //console.log(getMetiersByTechnicienUrl,getTachesByMetierUrl, 
    getTarificationsByTacheUrl);
    

    function getAdresseByClient(val) {
        if(val.length>0) {
            var client_id = val;
            $.get(getAdresseByClientUrl+'/'+client_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.adresses,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.code_postal+'</option>';
                });
                $('#adresses').html(html);

            });
        }
    }


    function getTachesByMetier(val) {
        if(val.length>0) {
            var metier_id = val;
            $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.taches,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_tache+'</option>';
                });
                $('#taches').html(html);

            });
        }
    }

     function getTechniciensByTache(val) {
        if(val.length>0) {
            var tache_id = val;
            $.get(getTechniciensByTacheUrl+'/'+tarificationtache_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.techniciens,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.nom+'</option>';
                });
                $('#techniciens').html(html);

            });
        }
    }



    function getTarificationsByTache(val) {

        if(val.length>0) {
            var tache_id = val;
            $.get(getTarificationsByTacheUrl+'/'+tache_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.tarifications,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.tarif+'</option>';
                });
                $('#tarifications').html(html);

            });
        }
    }

    function getTechniciensByTarificationtache(val) {
        if(val.length>0) {
            var tarificationtache_id = val;
            $.get(getTechniciensByTarificationtacheUrl+'/'+tarificationtache_id,function(res) 
               {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.techniciens,function(index,item) {
                   html+='<option value="'+item.id+'">'+item.user.nom+'</option>';
                   
                });
                $('#techniciens').html(html);

            });
        }
    }


</script>

Metier: -Select- @foreach($metiers as $t) {{$t->libelle_metier}} @endforeach

            <div class="col-md-4">
                <label>tache: </label>
                <select onchange="getTarificationsByTache(this.value)" style="width: 200px" class="productname form-control" name="tache" id="taches">
                <option value="">-Select-</option>
                </select>
            </div>


            



            <div class="col-md-4">
                <label>tarification: </label>
                <select onchange="getTechniciensByTarificationtache(this.value)" 
                 style="width: 200px" class="productname form-control" 
                   name="tarificationtache_id" id="tarifications">
                <option value="">-Select-</option>
                </select>
            </div>

chagouani left a reply on Display Table From Select Box

@ardnor can you help me to implement in my code

chagouani left a reply on Display Table From Select Box

@ardnor i have 2 relativ select box

1- choose a 'metier'
    2-choose  a 'tache'
    3-shown just liste of' tarification_tache' where 'tache_id' on table 'tarificationtache'= choosen 'tache'

chagouani left a reply on Display Table From Select Box

@ardnor how am I going to put screenshot ?

chagouani started a new conversation Display Table From Select Box

I have a view that contains 2 select box dynamic

we choose a 'metier' the list of 'tache' is displayed we choose a 'tache' I would like to display a table that contains the list of 'tarificationtaches' that are the selected' tache' in the select box

iterventioncontroller

 public function index()
 {
 $Listintervention=Intervention::with(['technicien','client' 
 ,'tarificationtache'])->get();

return view('intervention.index',['interventions'=>$Listintervention]);


 }


 /**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
 public function create()

{

$client = client::orderBy('id', 'asc')->get();
$metiers = metier::orderBy('id', 'asc')->get();
$technicien = Technicien::orderBy('id', 'desc')->get();
$tarifications = tarificationtache::with('techniciens.user')->get(); 

return view('intervention.create')->with('technicien', $technicien)- 
>with('client',$client)- 
>with('metiers',$metiers)->with('tarifications',$tarifications);
}

 /**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(InterventionRequest $request)
{
$intervention = new Intervention();

$intervention ->description =$request->input('description');
$intervention ->duree_prevu =$request->input('duree_prevu');


if($request->has('statut')){
$intervention->statut = $request->input('statut');
}else{
       $intervention->statut = 0;
}

$intervention ->technicien_id = $request->input('technicien_id');
$intervention ->client_id = $request->input('client_id');
$intervention ->tarification_id = $request->tarificationtache_id;
$intervention->save();
return redirect('intervention');
}

public function getTar(){
     $tarifications = tarificationtache::with('technicien')->get();

        return $tarifications->map(function ($tarification) {
            return [
                'nom' => $tarification->technicien->user->nom,
                'tache' => $tarification->tache_id,
                'tarif' => $tarification->tarif,
                'avg_avis_interventions' => $tarification->technicien- 
                >avisinterventions->avg('note')
            ];
        }); 

        print_r($results -> toJson());   
        exit;
}

create.blade.php

 @extends('Layouts/app')
 @extends('Layouts/master')
 @section('content')
<!--  jQuery -->
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"> 
</script>
 <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/ 
 bootstrap.min.css" rel="stylesheet">

 <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap- 
 datepicker/1.5.0/css/bootstrap- 
 datepicker.css" rel="stylesheet">

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap- 
datepicker/1.5.0/js/bootstrap- 
datepicker.js"></script>


<script type="text/javascript">
var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
var getAdresseByClientUrl = "{{url('/adressebyclient')}}";
var getTarificationsByTacheUrl = "{{url('/tarificationsbytache')}}";
var getTechniciensByTarificationtacheUrl = " 
{{url('/techniciensbytarificationtache')}}";
//console.log(getMetiersByTechnicienUrl,getTachesByMetierUrl 
,getTarificationsByTacheUrl);


function getAdresseByClient(val) {
    if(val.length>0) {
        var client_id = val;
        $.get(getAdresseByClientUrl+'/'+client_id,function(res) {
            var html = '<option value="">-Select-</option>' ;
            $.each(res.adresses,function(index,item) {
                html+='<option 
  value="'+item.id+'">'+item.code_postal+'</option>';
            });
            $('#adresses').html(html);

        });
    }
}


function getTachesByMetier(val) {
    if(val.length>0) {
        var metier_id = val;
        $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
            var html = '<option value="">-Select-</option>' ;
            $.each(res.taches,function(index,item) {
                html+='<option 
  value="'+item.id+'">'+item.libelle_tache+'</option>';
            });
            $('#taches').html(html);

        });
    }
}

 function getTechniciensByTache(val) {
    if(val.length>0) {
        var tache_id = val;
        
 $.get(getTechniciensByTacheUrl+'/'+tarificationtache_id,function(res) {
            var html = '<option value="">-Select-</option>' ;
            $.each(res.techniciens,function(index,item) {
                html+='<option value="'+item.id+'">'+item.nom+'</option>';
            });
            $('#techniciens').html(html);

        });
    }
}


function rowSelect(currentRow){
    //this is the code to set a dropdown menu using jquery
    var technicien_id = selectedRow.children[0].innerHTML;
    $("#your_technicien_dropdown_menu_id").val(technicien_id);
}

</script>
@if(count($errors))
<div class="alert alert-danger" role="alert">
    <ul>
        @foreach($errors ->all() as $message)
            <li>{{$message}}</li>
        @endforeach
    </ul>
</div>
@endif
<div class="container">
<div class="row"></div>
<div class="col-md-10">
    <h1>Ajout Intervention</h1>
    <form action=" {{url ('intervention')  }}" method="post">
        {{csrf_field()}}
        <div class="form-group">
            <label for="client">Client</label>
            <select onchange="getAdresseByClient(this.value)" 
 name="client_id" id="client" 
 class="form-control">
                <option value="">-Select-</option>
                @foreach($client as $t)
                    <option value="{{$t->id }}">
                        {{$t->user->nom}}
                    </option>
                @endforeach
            </select>
        </div>


        <div class="form-group">
            <label for="">date et heure </label>
            <input class="form-control" type="datetime-local"  name 
  ="duree_prevu" value=" 
  {{old('duree_prevu')}}">
        </div>

        <div class="form-group">
            <label for="">description</label>
            <input type="text"  name ="description" class="form- 
  control"value=" 
  {{old('description')}}">
        </div>

<div class="form-group">
            <div class="col-md-12">
            <div class="col-md-4">
            <label>Metier: </label>
            <select onchange="getTachesByMetier(this.value)" style="width: 
  200px" 
   class="productm form-control" id="metiers">
           <option value="">-Select-</option>
                @foreach($metiers as $t)
                    <option value="{{$t->id }}">
                        {{$t->libelle_metier}}
                    </option>
                @endforeach
            </select>
        </div>

        <div class="col-md-4">
            <label>tache: </label>
            <select onchange="getTarificationsByTache(this.value)" 
 style="width: 200px" 
 class="productname form-control" name="tache" id="taches">
            <option value="">-Select-</option>
            </select>
        </div>

        
</div>
        <div class="form-group">
            <div class="form-group">
            <label for="">statut    :   </label>
            <input type="checkbox"  name ="statut" value="1" required 
            autofocus>
        </div>
        <div class="form-group">
            <label for="">payement</label>
            <input type="checkbox"  name ="payement" value="">
        </div>
        <div class="form-group">

            <input type="submit" value = "enregistrer" class="form-control 
            btn btn-primary">
        </div>
 </div>
 </div>
 </div>
 <script>
 function getMessage(){
     $.ajax({
              type:'GET',
              url:your_url,
              dataType: 'json',
              success:function(tarifications_list){
                $table_body = $("#tbl_body_name");
                $table_body.empty();

                if (tarifications_list.length > 0) {
                    div_no_data.style.display = 'none';
                    $.each(tarifications_list, function (index, value) {
                        $table_body.append('<tr class="deselected" 
 onclick="rowSelect(this)">' +
                            '<td style="text-align: left;">' + 
 value.technicien_id  + '</td>' +
                            '<td style="text-align: left;">' + 
 value.tache_id + '</td>' +
                            '</tr>');
                    });
                }
              }
            });
 }
 </script>
 @endsection



 

table tarificationtaches

public function up()
{
Schema::create('tarificationtaches', function (Blueprint $table) {
    $table->increments('id');
    $table->float('tarif', 8,2);
    $table->integer('tache_id')->unsigned();
    $table->foreign('tache_id')->references('id')->on('taches');
    $table->integer('technicien_id')->unsigned();
    $table->foreign('technicien_id')->references('id')->on('techniciens');
    $table->datetime('deleted_at')->nullable();
    $table->timestamps();
});
}
17 Aug
3 months ago

chagouani left a reply on Laravel : Check Before Insertion

I have tried this function but i have some error

 public function store(Request $request)
  {
   
    $tarification = new tarificationtache();
    $tarification ->tache_id = $request->input('tache_id');
    $tarification ->Tarif =$request->input('Tarif');
    $tarification->technicien_id = $request->input('technicien_id');
    $tarification = DB::select("select * FROM tarificationtaches where 
     technicien_id = 'technicien_id' and tache_id = input('tache_id')");
        if(request($tarification) > 1)
         echo "Ce technicien a cette tarification";
        else{
        
        $tarification->save();
        
 }}

errors

SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION projet2.input 
    does not exist (SQL: select * FROM tarificationtaches where \n
     technicien_id = 'technicien_id' and tache_id = input('tache_id'))

chagouani started a new conversation Laravel : Check Before Insertion

I have to insert to 'technicien'='technician' there 'tache'='task' and 'tarification' ='price'

Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')->on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

each techncien have to make there 'tache' then I would like to add a condition in my function to check the insertion if the 'tache' already exists if yes it displays to me existing' tache' if it does not insert in the database

 public function store(Request $request)
    {
   
    $tarification = new tarificationtache();
    $tarification ->tache_id = $request->input('tache_id');
    $tarification ->Tarif =$request->input('Tarif');
    $tarification->technicien_id = $request->input('technicien_id');
    $tarification->save();
    
    return redirect('technicien');  
}
27 Jul
4 months ago

chagouani left a reply on How To Convert This Store Function To Json

@lostdreamer_nl can you helping me to solved please

chagouani left a reply on How To Convert This Store Function To Json

@lostdreamer_nl

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: in file C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php on line 255 Stack trace:

  1. Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException->() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php:255
  2. Illuminate\Routing\RouteCollection->methodNotAllowed() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php:242
  3. Illuminate\Routing\RouteCollection->getRouteForMethods() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\RouteCollection.php:176
  4. Illuminate\Routing\RouteCollection->match() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php:612
  5. Illuminate\Routing\Router->findRoute() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php:601
  6. Illuminate\Routing\Router->dispatchToRoute() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php:590
  7. Illuminate\Routing\Router->dispatch() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:176
  8. Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:30
  9. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\fideloper\proxy\src\TrustProxies.php:56
  10. Fideloper\Proxy\TrustProxies->handle() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
  11. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
  12. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:30
  13. Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
  14. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
  15. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php:30
  16. Illuminate\Foundation\Http\Middleware\TransformsRequest->handle() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
  17. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
  18. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php:27
  19. Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
  20. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
  21. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php:46
  22. Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:149
  23. Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php:53
  24. Illuminate\Routing\Pipeline->Illuminate\Routing{closure}() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php:102
  25. Illuminate\Pipeline\Pipeline->then() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:151
  26. Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter() C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php:116
  27. Illuminate\Foundation\Http\Kernel->handle() C:\xampp\htdocs\projet\public\index.php:55

chagouani left a reply on How To Convert This Store Function To Json

@lostdreamer_nl this is my table migration

 public function up()
{
    Schema::create('avis_interventions', function (Blueprint $table) {
        $table->increments('id');
        $table->string('qualité');
        $table->integer('nbr_heure');
        $table->string('service');
        $table->float('note', 1,1);
        $table->integer('client_id')->unsigned();
        $table->foreign('client_id')->references('id')->on('clients');
        $table->integer('intervention_id')->unsigned();
        $table->foreign('intervention_id')->references('id')->on('interventions');
        $table->timestamps();
    });
}

chagouani left a reply on How To Convert This Store Function To Json

@cmdobueno when i have make your code i have this error :

Could not get any response
There was an error connecting to http://192.168.1.233/projet/public/api/avs.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General
26 Jul
4 months ago

chagouani left a reply on How To Convert This Store Function To Json

@lostdreamer_nl sorry i have problém whith my application so i have solved now and i have make you function i have this error

Illuminate\Database\QueryException: SQLSTATE[23000]: Integrity constraint 
    violation
23 Jul
4 months ago

chagouani started a new conversation Show The Result Of Relative Selects Box On Table

1/ I have 2 relative select box I must choose a "metier" well a relative " tache" well I would like to display the list of the "technicien" who had the spot selected in a table

2/ when I had the table I must choose a "technicien" in the table to record his "id" on "intervention table"

I have not found any solution for a long time

create.blade.php

    @extends('Layouts/app')

@extends('Layouts/master')

@section('content')
<!--  jQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" 
 rel="stylesheet">

<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap- 
 datepicker.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap- 
datepicker.js"></script>


    <script type="text/javascript">

    
    var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
    var getAdresseByClientUrl = "{{url('/adressebyclient')}}";
    var getTarificationsByTacheUrl = "{{url('/tarificationsbytache')}}";
    var getTechniciensByTarificationtacheUrl = "{{url('/techniciensbytarificationtache')}}";
    //console.log(getMetiersByTechnicienUrl, 
    getTachesByMetierUrl,getTarificationsByTacheUrl);
    

    function getAdresseByClient(val) {
        if(val.length>0) {
            var client_id = val;
            $.get(getAdresseByClientUrl+'/'+client_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.adresses,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.code_postal+'</option>';
                });
                $('#adresses').html(html);

            });
        }
    }


    function getTachesByMetier(val) {
        if(val.length>0) {
            var metier_id = val;
            $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.taches,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_tache+'</option>';
                });
                $('#taches').html(html);

            });
        }
    }

     function getTechniciensByTache(val) {
        if(val.length>0) {
            var tache_id = val;
            $.get(getTechniciensByTacheUrl+'/'+tarificationtache_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.techniciens,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.nom+'</option>';
                });
                $('#techniciens').html(html);

            });
        }
    }



    function getTarificationsByTache(val) {

        if(val.length>0) {
            var tache_id = val;
            $.get(getTarificationsByTacheUrl+'/'+tache_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.tarifications,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.tarif+'</option>';
                });
                $('#tarifications').html(html);

            });
        }
    }

   
    function rowSelect(currentRow){
        //this is the code to set a dropdown menu using jquery
        var technicien_id = selectedRow.children[0].innerHTML;
        $("#your_technicien_dropdown_menu_id").val(technicien_id);
    }




</script>



@if(count($errors))
    <div class="alert alert-danger" role="alert">
        <ul>
            @foreach($errors ->all() as $message)
                <li>{{$message}}</li>
            @endforeach
        </ul>
    </div>
 @endif
 <div class="container">
    <div class="row"></div>
    <div class="col-md-10">
        <h1>Ajout Intervention</h1>
        <form action=" {{url ('intervention')  }}" method="post">
            {{csrf_field()}}
            <div class="form-group">
                <label for="client">Client</label>
                <select onchange="getAdresseByClient(this.value)" name="client_id" id="client" 
  class="form-control">
                    <option value="">-Select-</option>
                    @foreach($client as $t)
                        <option value="{{$t->id }}">
                            {{$t->user->nom}}
                        </option>
                    @endforeach
                </select>
            </div>


            <div class="form-group">
                <label for="">date et heure </label>
                <input class="form-control" type="datetime-local"  name ="duree_prevu" value=" 
  {{old('duree_prevu')}}">
            </div>

            <div class="form-group">
                <label for="">description</label>
                <input type="text"  name ="description" class="form-control"value=" 
  {{old('description')}}">
            </div>

    <div class="form-group">
                <div class="col-md-12">
                <div class="col-md-4">
                <label>Metier: </label>
                <select onchange="getTachesByMetier(this.value)" style="width: 200px" 
  class="productm form-control" id="metiers">
               <option value="">-Select-</option>
                    @foreach($metiers as $t)
                        <option value="{{$t->id }}">
                            {{$t->libelle_metier}}
                        </option>
                    @endforeach
                </select>
            </div>

            <div class="col-md-4">
                <label>tache: </label>
                <select onchange="getTarificationsByTache(this.value)" style="width: 200px" 
  class="productname form-control" name="tache" id="taches">
                 <option value="">-Select-</option>
                </select>
            </div>

            <table class="table table-bordered bg-light">
        <thead class="bg-dark" style=" color: white">
                <tr>
                     <th class="light-table-filter" data-table="order-table" placeholder="Filter" style=" 
 color: #337ab7">technicien </th>
                     <th class="light-table-filter" data-table="order-table" placeholder="Filter" style=" 
 color: #337ab7">Tache </th>
                    <th class="light-table-filter" data-table="order-table" placeholder="Filter" style=" 
 color: #337ab7">tarif </th>
                    
                   
                    <th style="color: #337ab7" width="220px" style="vertical-align: 
   middle">Action</th>
                    
                </tr>
                </thead>
                <tbody>
                @foreach($tarifications as $tarifications)
                <tr>
                    <td>{{$tarifications->technicien->user->nom}}</td>
                    <td>{{$tarifications->tache->libelle_tache}}</td>
                    <td>{{$tarifications->tarif}}</td>
                    
                    <td>
                        <div class="form-group">
                            <div class="form-group">
                            
                            <input type="checkbox"  name ="tarifications" value="id">
                        </div>
                    </td>
                </tr>
                @endforeach
                </body>
            </table>
 </div>
            <div class="form-group">
                <div class="form-group">
                <label for="">statut    :   </label>
                <input type="checkbox"  name ="statut" value="1" required autofocus>
            </div>
            <div class="form-group">
                <label for="">payement</label>
                <input type="checkbox"  name ="payement" value="">
            </div>
            <div class="form-group">

                <input type="submit" value = "enregistrer" class="form-control btn btn-primary">
            </div>
  </div>
  </div>
   </div>
  <script>
     function getMessage(){
         $.ajax({
                  type:'GET',
                  url:your_url,
                  dataType: 'json',
                  success:function(tarifications_list){
                    $table_body = $("#tbl_body_name");
                    $table_body.empty();

                    if (tarifications_list.length > 0) {
                        div_no_data.style.display = 'none';
                        $.each(tarifications_list, function (index, value) {
                            $table_body.append('<tr class="deselected" onclick="rowSelect(this)">' +
                                '<td style="text-align: left;">' + value.technicien_id  + '</td>' +
                                '<td style="text-align: left;">' + value.tache_id + '</td>' +
                                '</tr>');
                        });
                    }
                  }
                });
     }
  </script>
 @endsection

controller

 public function create()

{

    $client = client::orderBy('id', 'asc')->get();
    $metiers = metier::orderBy('id', 'asc')->get();
    $technicien = Technicien::orderBy('id', 'desc')->get();
    $tarifications=tarificationtache::with(['technicien','tache'])->get(); 
    
    return view('intervention.create')->with('technicien', $technicien)->with('client',$client)- 
    >with('metiers',$metiers)->with('tarifications',$tarifications);
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(InterventionRequest $request)
{
    $intervention = new Intervention();
    
    $intervention ->description =$request->input('description');
    $intervention ->duree_prevu =$request->input('duree_prevu');
    

    if($request->has('statut')){
    $intervention->statut = $request->input('statut');
    }else{
           $intervention->statut = 0;
    }
    
    $intervention ->technicien_id = $request->input('technicien_id');
    $intervention ->client_id = $request->input('client_id');
    $intervention ->tarification_id = $request->tarificationtache_id;
    $intervention->save();
    return redirect('intervention');




}
20 Jul
4 months ago

chagouani started a new conversation Slect Box Shown Table With Ajax

I have to make à view with 2 relative select box wen i choise the secend a table is displayed and in its table I can choose a line for inserting data can some redirects me to the solution and if I can see an example

I have more than months I seek the solution and I have not managed to find it ,

and this is my question , can some one help me please

18 Jul
4 months ago

chagouani started a new conversation How To Convert This Store Function To Json

Strore function

public function store(Request $request)
    {

    $avis = new AvisIntervention();
    $avis ->qualité =$request->input('qualité');
    $avis ->nbr_heure =$request->input('nbr_heure');
    $avis ->service =$request->input('service');
    $avis ->note =$request->input('note');
    $avis ->client_id =$request->input('client_id');
    $avis ->intervention_id = $request->input('intervention_id');
    $avis->save();
    return redirect('avis');

  }
06 Jul
5 months ago

chagouani left a reply on Syntax Error Or Access Violation: 1305 FUNCTION Projet2.input Does Not Exist

@tomopongrac thanks for your answer when i have try your answer i have this errors SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION projet2.input does not exist (SQL: select * FROM tarificationtaches where \n technicien_id = 'technicien_id' and tache_id = input('tache_id'))

chagouani started a new conversation Syntax Error Or Access Violation: 1305 FUNCTION Projet2.input Does Not Exist

I have this function or the user will add a 'tarificationtaches' to the 'technicien' each 'technicien' have a single 'tarificationtaches'for a selected 'tache' I wanted to make a select to check if the 'technician_id' and the 'tache_id' already exist in the pricing table stain but I have this error

("SQLSTATE[42000]: Syntax error or access violation: 1305 FUNCTION projet2.input does not 
exist (SQL: select * FROM tarificationtaches where \n
    technicien_id = 'technicien_id' and tache_id = input('tache_id'))”)

this is my controller

 <?php

 namespace App\Http\Controllers;

 use Illuminate\Http\Request;
 use App\tarificationtache;
 use App\technicien;
 use App\tache;
 use App\metier;

 class TarificationController extends Controller
{
/**
 * Display a listing of the resource.
 *
 * @return \Illuminate\Http\Response
 */

public function index() { $Listtarifications=tarificationtache::with(['techniciens.user','tache'])- >find($tarificationtache_id);

    return view('tarification.index',['tarifications'=>$Listtarifications]);

   
}


/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create($technicien_id)   
{
    $technicien = technicien::orderBy('id','desc')->get();
    $taches = Tache::orderBy('libelle_tache', 'asc')->get();
    $metiers = Metier::orderBy('libelle_metier', 'asc')->get();
    return view('tarification.create')->with('taches', $taches)->with('technicien', $technicien)- 
   >with('metiers', $metiers)->with('technicien_id', $technicien_id);
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
   
    $tarification = new tarificationtache();
    $tarification ->tache_id = $request->input('tache_id');
    $tarification ->Tarif =$request->input('Tarif');
    $tarification->technicien_id = $request->input('technicien_id');
    $tarification = DB::select("select * FROM tarificationtaches where 
    technicien_id = 'technicien_id' and tache_id = input('tache_id')");

        if(request($tarification) > 1)
         echo "Ce technicien a cette tarification";
        else{
        
        $tarification->save();
 }

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function show($id)
{
    //
}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function edit($id)
{
    $tache=Tache::find($id);
    return view('tache.edit',['libelle_tache'=>$tache],['Tarif'=>$tache],['metier_id'=>$tache]);
}

/**
 * Update the specified resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function update(Request $request, $id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function destroy($id)
{
    $tache =Tache::find($id);
    $tache->delete();

    return redirect('tache');
}
public function getTarificationsByTache($tache_id)
{
    $t =tache::find($tache_id);
    return response()->json(['tarifications' => $t->tarificationtache]);
}
}

tabel tarificationtaches

 Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')- 
        >on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

chagouani left a reply on Syntax Error Or Access Violation: 1305 FUNCTION Projet2.input Does Not Exist

@Anwar thank you anwer but i have change my answer if you can help me please

chagouani started a new conversation “Parse Error: Syntax Error, Unexpected 'public' (T_PUBLIC)”

I have this function or the user will add a 'tarificationtaches' to the 'technicien' each 'technicien' have a single 'tarificationtaches'for a selected 'tache' I wanted to make a select to check if the 'technician_id' and the 'tache_id' already exist in the pricing table stain but I have this error

("“Parse error: syntax error, unexpected 'public' (T_PUBLIC)”)

this is my controller

 <?php

 namespace App\Http\Controllers;

 use Illuminate\Http\Request;
 use App\tarificationtache;
 use App\technicien;
 use App\tache;
 use App\metier;

 class TarificationController extends Controller
{
/**
 * Display a listing of the resource.
 *
 * @return \Illuminate\Http\Response
 */

public function index() { $Listtarifications=tarificationtache::with(['techniciens.user','tache'])- >find($tarificationtache_id);

    return view('tarification.index',['tarifications'=>$Listtarifications]);

   
}


/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create($technicien_id)   
{
    $technicien = technicien::orderBy('id','desc')->get();
    $taches = Tache::orderBy('libelle_tache', 'asc')->get();
    $metiers = Metier::orderBy('libelle_metier', 'asc')->get();
    return view('tarification.create')->with('taches', $taches)->with('technicien', $technicien)- 
   >with('metiers', $metiers)->with('technicien_id', $technicien_id);
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
   
    $tarification = new tarificationtache();
    $tarification ->tache_id = $request->input('tache_id');
    $tarification ->Tarif =$request->input('Tarif');
    $tarification->technicien_id = $request->input('technicien_id');
    $tarification = DB::select("select * FROM tarificationtaches where 
    technicien_id = 'technicien_id' and tache_id = input('tache_id')");

        if(request($tarification) > 1)
         echo "Ce technicien a cette tarification";
        else{
        
        $tarification->save();
 }

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function show($id)
{
    //
}

/**
 * Show the form for editing the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function edit($id)
{
    $tache=Tache::find($id);
    return view('tache.edit',['libelle_tache'=>$tache],['Tarif'=>$tache],['metier_id'=>$tache]);
}

/**
 * Update the specified resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function update(Request $request, $id)
{
    //
}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function destroy($id)
{
    $tache =Tache::find($id);
    $tache->delete();

    return redirect('tache');
}
public function getTarificationsByTache($tache_id)
{
    $t =tache::find($tache_id);
    return response()->json(['tarifications' => $t->tarificationtache]);
}
}

tabel tarificationtaches

 Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')- 
        >on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });
26 Jun
5 months ago

chagouani left a reply on Column Not Found: 1054 Unknown Column

@tomopongrac i have change on my model like this but

 return $this->hasMany(intervention::class, 'tarification_id');

but now i have this error

"Property [intervention] does not exist on this collection instance."

chagouani started a new conversation Column Not Found: 1054 Unknown Column

I have a function that displays the 'tarificationtaches' whith the avg of moyenne_avis from table avis intervention related to intervention i have this error

"SQLSTATE[42S22]: Column not found: 1054 Unknown column      
    'interventions.tarificationtache_id' in 'where clause' (SQL: select * from `interventions` 
where `interventions`.`tarificationtache_id` in (1, 2, 3, 4))

tarificationtaches_tables

Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')- 
        >on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

techniciens_tables

 Schema::create('techniciens', function (Blueprint $table) {
        $table->increments('id');
        $table->boolean('actif')->default(1);
        $table->float('moyenne_avis')->nullable();
        $table->integer('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
        
    });

avis_interventions_tables

Schema::create('avis_interventions', function (Blueprint $table) {
        $table->increments('id');
        $table->string('qualité');
        $table->integer('nbr_heure');
        $table->string('service');
        $table->float('note', 1,1);
        $table->integer('client_id')->unsigned();
        $table->foreign('client_id')->references('id')->on('clients');
        $table->integer('intervention_id')->unsigned();
        $table->foreign('intervention_id')->references('id')- 
        >on('interventions');
        $table->timestamps();
    });

interventions_tables

 Schema::create('interventions', function (Blueprint $table) {
        $table->increments('id');
        $table->date('date_intervention')->nullable();
        $table->string('description');
        $table->dateTime('duree_prevu');
        $table->boolean('statut');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')- 
        >on('techniciens');
        $table->integer('tarification_id')->unsigned();
        $table->foreign('tarification_id')->references('id')- 
        >on('tarificationtaches');
        $table->integer('client_id')->unsigned();
        $table->foreign('client_id')->references('id')->on('Clients');


        $table->timestamps();
    });

this is my function

 public function getTar(){
     $tarifications = tarificationtache::with('technicien','intervention')->get();
        $notes = $tarifications->intervention->avisinterventions->pluck('note');
        $moyenne = $tarifications->intervention()->avisinterventions()->avg('note');
        return $tarifications->map(function ($tarification) {
            return [
                'nom' => $tarification->technicien->user->nom,
                'moyenne_avis' => $tarification->intervention->avisinterventions->avg('note'),
                'tache' => $tarification->tache->libelle_tache,
                'tarif' => $tarification->tarif,
            ];
        });    


   
}

chagouani started a new conversation Json

I have a function that displays the 'tarificationtaches' list i would like to add an avg to get the average 'techniciens' moyenne_avis from tables avis_intervention where "intervention.technicien_id" = "tarificationtaches.techncien_id" , in this is my schema .

tarificationtaches_tables

Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')->on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

techniciens_tables

 Schema::create('techniciens', function (Blueprint $table) {
        $table->increments('id');
        $table->boolean('actif')->default(1);
        $table->float('moyenne_avis')->nullable();
        $table->integer('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
        
    });

avis_interventions_tables

Schema::create('avis_interventions', function (Blueprint $table) {
        $table->increments('id');
        $table->string('qualité');
        $table->integer('nbr_heure');
        $table->string('service');
        $table->float('note', 1,1);
        $table->integer('client_id')->unsigned();
        $table->foreign('client_id')->references('id')->on('clients');
        $table->integer('intervention_id')->unsigned();
        $table->foreign('intervention_id')->references('id')->on('interventions');
        $table->timestamps();
    });

interventions_tables

 Schema::create('interventions', function (Blueprint $table) {
        $table->increments('id');
        $table->date('date_intervention')->nullable();
        $table->string('description');
        $table->dateTime('duree_prevu');
        $table->boolean('statut');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')->on('techniciens');
        $table->integer('tarification_id')->unsigned();
        $table->foreign('tarification_id')->references('id')->on('tarificationtaches');
        $table->integer('client_id')->unsigned();
        $table->foreign('client_id')->references('id')->on('Clients');


        $table->timestamps();
    });

this is my function

public function getTar(){
     $tarifications = tarificationtache::with('technicien')->get();

        return $tarifications->map(function ($tarification) {
            return [
                'nom' => $tarification->technicien->user->nom,
                'moyenne_avis' => $tarification->technicien->moyenne_avis,
                'tache' => $tarification->tache->libelle_tache,
                'tarif' => $tarification->tarif,
            ];
        });    


   
}

it shown like this

[{"nom":"tech 1","moyenne_avis":null,"tache":"tache 2","tarif":29.55},{"nom":"tech   
    2","moyenne_avis":null,"tache":"tache 3","tarif":55.12},{"nom":"tech 
    1","moyenne_avis":null,"tache":"tache 3","tarif":253},{"nom":"tech 
    2","moyenne_avis":null,"tache":"tache 3","tarif":28.22}]

NB: the moyenne_avis is null because he display moyenne_avis from technicien and i dont have any insert on .

25 Jun
5 months ago

chagouani started a new conversation How To Check An Existing 'tarificationtache'

I have an interface of 'tarificationtache' in this interface the 'technicien' can have pricing for its 'taches' and for each 'tache' a single 'tarif', I would like to check if this 'tache' it has a 'tarif' for this 'technicien' if yes it retur a message 'tarifi exist' if it creates it .

table tarificationtaches

Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')->on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

create.blade.php

@extends('Layouts/app')
@extends('Layouts.master')
@section('content')
 @if(count($errors))
    <div class="alert alert-danger" role="alert">
    <ul>
    @foreach($errors ->all() as $message)
     <li>{{$message}}</li>
        @endforeach
    </ul>
    </div>
 @endif
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script type="text/javascript">
    var getMetiersByTechnicienUrl = "{{url('/metiersbytechnicien')}}";
    var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
    //console.log(getMetiersByTechnicienUrl,getTachesByMetierUrl, 
     getTarificationsByTacheUrl);
    function getMetiersByTechnicien(val) {
        if(val.length>0) {
            var technicien_id = val;
            $.get(getMetiersByTechnicienUrl+'/'+technicien_id,function(res) {
                var html = '<option value=">-Select-"</option>' ;
                $.each(res.metiers,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_metier+'</option>';
                });
                $('#metiers').html(html);

            });
        }
    }

   


    function getTachesByMetier(val) {
        if(val.length>0) {
            var metier_id = val;
            $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.taches,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_tache+'</option>';
                });
                $('#taches').html(html);

            });
        }
    }
    </script>

<div class="container">
    <div class="row"></div>
    <div class="col-md-12">
       
       <div class="col-md-10">
            <h1>Tarification tache</h1>
        <form action=" {{url ('tarification')  }}" method="post">
         {{csrf_field()}}

        <div class="form-group">
            <label for="technicien">Technicien</label>
               <select onchange="getMetiersByTechnicien(this.value)" name="technicien_id" 
                  id="technicien_id" class="form-control">
                       <option value="">-Select-</option>
                       @foreach($technicien as $t)
                              <option value="{{$t->id }}" {{ $t->id == $technicien_id ? 'selected = "selected"' 
                              : '' }}>
                                    {{$t->user->nom}}
                              </option>
                       @endforeach
                </select>
        </div>
        <div class="form-group">
            <div class="col-md-12">
                    <div class="col-md-4">
<label>Metier: </label>
<select onchange="getTachesByMetier(this.value)" style="width: 
200px" class="productm form-control" id="metiers">
    <option value="">-Select-</option>
@foreach($metiers as $metier)
      <option value={{$metier->id}}>{{$metier->libelle_metier}}</option>
@endforeach

tache: -Select- tarification:

    <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap- 
    datepicker.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap- 
    datepicker.js"></script>
   @endsection

controller

 public function create($technicien_id)   
{
    $technicien = technicien::orderBy('id','desc')->get();
    $taches = Tache::orderBy('libelle_tache', 'asc')->get();
    $metiers = Metier::orderBy('libelle_metier', 'asc')->get();
    return view('tarification.create')->with('taches', $taches)->with('technicien', $technicien)- 
>with('metiers', $metiers)->with('technicien_id', $technicien_id);
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
   
    $tarification = new tarificationtache();
    $tarification ->tache_id = $request->input('tache_id');
    $tarification ->Tarif =$request->input('Tarif');
    $tarification->technicien_id = $request->input('technicien_id');
    $tarification->save();
    
    return redirect('technicien');  }

chagouani started a new conversation Laravel Query Join As Json

I'm trying to build one service json Laravel. I want to show liste of tarificationtaches groupe by tache .

table techniciens

    Schema::create('techniciens', function (Blueprint $table) {
        $table->increments('id');
        $table->boolean('actif')->default(1);
        $table->float('moyenne_avis')->nullable();
        $table->integer('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
        
    });

table users

    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('email');
        $table->string('password');
        $table->string('nom');
        $table->string('prenom');
        $table->string('tel');
        $table->string('mobil');
        $table->boolean('role')->default(0);
        $table->datetime('deleted_at')->nullable();
        $table->rememberToken();
        $table->timestamps();
    });

table tarificationtaches

    Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')- 
        >on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });

function

public function getTar($id){
$taches=  Tache::with("tarificationtache")->get();
return response(compact('taches'));
}

i have this function it shown like this

{"taches":[{"id":1,"libelle_tache":"montage  porte   
 simple","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06- 
 08 11:41:41","updated_at":"2018-06-08 11:41:41","tarificationtache":[]}, 
 {"id":2,"libelle_tache":"tache 
 1","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
 11:41:55","updated_at":"2018-06-08 11:41:55","tarificationtache":[]}, 
 {"id":3,"libelle_tache":"tache 
 2","Tarif":null,"metier_id":2,"deleted_at":null,"created_at":"2018-06-08 
 11:42:01","updated_at":"2018-06-08 11:42:01","tarificationtache": 
 [{"id":1,"tarif":29.55,"tache_id":3,"technicien_id":1,"deleted_at":null, 
 "created_at":"2018-06-08 11:58:54","updated_at":"2018-06-08 11:58:54"}]}, 
 {"id":4,"libelle_tache":"tache 
 3","Tarif":null,"metier_id":3,"deleted_at":null,"created_at":"2018-06-08 
 12:00:15","updated_at":"2018-06-08 12:00:15","tarificationtache": 
 [{"id":2,"tarif":55.12,"tache_id":4,"technicien_id":2,"deleted_at":null 
 ,"created_at":"2018-06-08 12:00:37","updated_at":"2018-06-08 12:00:37"}, 
 {"id":3,"tarif":253,"tache_id":4,"technicien_id":1,"deleted_at":null 
 ,"created_at":"2018-06-15 23:17:23","updated_at":"2018-06-15 23:17:23"}, 
 {"id":4,"tarif":28.22,"tache_id":4,"technicien_id":2,"deleted_at":null 
 ,"created_at":"2018-06-20 17:03:32","updated_at":"2018-06-20 17:03:32"}]}]}

but i would like to have the 'nom' of technicien not the 'technicien_id'

id: N,
tache_id: "tache",
technicien_id: 5
     nom: "user.nom",
     
22 Jun
5 months ago

chagouani left a reply on Json

@biishmar when i make return $taches; he shown me like this

[{"id":1,"libelle_tache":"montage  porte 
    simple","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
    11:41:41","updated_at":"2018-06-08 11:41:41","tarificationtache":[]}, 
     {"id":2,"libelle_tache":"tache 
    1","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
    11:41:55","updated_at":"2018-06-08 11:41:55","tarificationtache":[]}, 
    {"id":3,"libelle_tache":"tache 
    2","Tarif":null,"metier_id":2,"deleted_at":null,"created_at":"2018-06-08 
    11:42:01","updated_at":"2018-06-08 11:42:01","tarificationtache": 
    [{"id":1,"tarif":29.55,"tache_id":3,"technicien_id":1,"deleted_at":null,"created_at":"2018- 
    06-08 11:58:54","updated_at":"2018-06-08 11:58:54"}]},{"id":4,"libelle_tache":"tache 
    3","Tarif":null,"metier_id":3,"deleted_at":null,"created_at":"2018-06-08 
   12:00:15","updated_at":"2018-06-08 12:00:15","tarificationtache": 
    [{"id":2,"tarif":55.12,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018- 
   06-08 12:00:37","updated_at":"2018-06-08 12:00:37"}, 
   {"id":3,"tarif":253,"tache_id":4,"technicien_id":1,"deleted_at":null,"created_at":"2018-06- 
    15 23:17:23","updated_at":"2018-06-15 23:17:23"}, 
    {"id":4,"tarif":28.22,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018- 
    06-20 17:03:32","updated_at":"2018-06-20 17:03:32"}]}]

but me i would like to shown the "nom" of "techniciens" from table "users" not the technicien_id from tarification

chagouani started a new conversation Json

I have 3 table

techniciens(id, user_id,actif , moyenne_avis) 
users (nom , prenom , adresse )
tarificationtaches (id , tarif , technicien_id,tache_id , tarif) 

I have a function to display the 'tarificationtache' list with the 'id' of technicien but i would to shown his 'nom' and 'moyenne_avis' group by (tache_id)

this is my service :

 public function getTar($id){

$taches=  Tache::with("tarificationtache")->get();
return response(compact('taches'));
}

he shown like this :

{"taches":[{"id":1,"libelle_tache":"montage  porte   
  simple","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:41","updated_at":"2018-06-08 11:41:41","tarificationtache":[]},{"id":2,"libelle_tache":"tache 
  1","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:55","updated_at":"2018-06-08 11:41:55","tarificationtache":[]},{"id":3,"libelle_tache":"tache 
  2","Tarif":null,"metier_id":2,"deleted_at":null,"created_at":"2018-06-08 
  11:42:01","updated_at":"2018-06-08 11:42:01","tarificationtache": 
  [{"id":1,"tarif":29.55,"tache_id":3,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-08 
 11:58:54","updated_at":"2018-06-08 11:58:54"}]},{"id":4,"libelle_tache":"tache 
 3","Tarif":null,"metier_id":3,"deleted_at":null,"created_at":"2018-06-08 
 12:00:15","updated_at":"2018-06-08 12:00:15","tarificationtache": 
[{"id":2,"tarif":55.12,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-08 
12:00:37","updated_at":"2018-06-08 12:00:37"}, 
{"id":3,"tarif":253,"tache_id":4,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-15 
23:17:23","updated_at":"2018-06-15 23:17:23"}, 
{"id":4,"tarif":28.22,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-20 
17:03:32","updated_at":"2018-06-20 17:03:32"}]}]}
21 Jun
5 months ago

chagouani started a new conversation Json Function To Shown Name And Avg Note

I have 5 table

techniciens(id, user_id,actif) 
users (nom , prenom , adresse )
tarificationtaches (id , tarif , technicien_id,tache_id , tarif) 
intervention(id , tarification_id , technicien_id....)
avis_interventions( id , intervention_id , note )

I have a web service function to display the 'tarificationtache' list with the id of technicien but i would to shown his name and the avg of 'avis_interventions'

this is my service :

 public function getTar($id){

$taches=  Tache::with("tarificationtache")->get();
return response(compact('taches'));
}

he shown like this :

{"taches":[{"id":1,"libelle_tache":"montage  porte   
  simple","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:41","updated_at":"2018-06-08 11:41:41","tarificationtache":[]},{"id":2,"libelle_tache":"tache 
  1","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:55","updated_at":"2018-06-08 11:41:55","tarificationtache":[]},{"id":3,"libelle_tache":"tache 
  2","Tarif":null,"metier_id":2,"deleted_at":null,"created_at":"2018-06-08 
  11:42:01","updated_at":"2018-06-08 11:42:01","tarificationtache": 
  [{"id":1,"tarif":29.55,"tache_id":3,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-08 
 11:58:54","updated_at":"2018-06-08 11:58:54"}]},{"id":4,"libelle_tache":"tache 
 3","Tarif":null,"metier_id":3,"deleted_at":null,"created_at":"2018-06-08 
 12:00:15","updated_at":"2018-06-08 12:00:15","tarificationtache": 
[{"id":2,"tarif":55.12,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-08 
12:00:37","updated_at":"2018-06-08 12:00:37"}, 
{"id":3,"tarif":253,"tache_id":4,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-15 
23:17:23","updated_at":"2018-06-15 23:17:23"}, 
{"id":4,"tarif":28.22,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-20 
17:03:32","updated_at":"2018-06-20 17:03:32"}]}]}

saying that the average rating i perform in laravel with this functin

 public function show($id)
{
    $technicien = technicien::findOrFail($id);
    $notes = $technicien->avisinterventions->pluck('note');
    $moyenne = $technicien->avisinterventions()->avg('note');
    

    $user = $technicien->user;
    $metier = $technicien->metier;
    $tarificationtache = $technicien->tarificationtache;
    $zoneintervention = $technicien->zoneintervention;


    return view('technicien.show' , compact('technicien'))->with('user',$user)- 
   >with('metier',$metier)->with('zoneintervention',$zoneintervention)- 
   >with('tarificationtache',$tarificationtache)->with('moyenne',$moyenne);

}

chagouani left a reply on Json

@tykus please i have 1 more json function can you help me

https://laracasts.com/discuss/channels/laravel/json-8

chagouani left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

@Vilfago I find that you always want to block me I'm looking for a solution if you can help me with a solution or with a link to understand like frater otherwise you do not stay with my question please

chagouani left a reply on JSON

@Vilfago i would like a json fonction to call it in android application

chagouani left a reply on JSON

@Vilfago i would like to shown the 'nom' and the avg note of technicien not the technicien_id

chagouani started a new conversation JSON

I have 5 table techniciens(id, user_id,actif) users (nom , prenom , adresse ) tarificationtaches (id , tarif , technicien_id,tache_id , tarif) intervention(id , tarification_id , technicien_id....) avis_interventions( id , intervention_id , note )

I have a web service function to display the 'tarificationtache' list with the id of technicien but i would to shown his name and the avg of 'avis_interventions'

this is my service :

 public function getTar($id){

$taches=  Tache::with("tarificationtache")->get();
return response(compact('taches'));
}

he shown like this :

{"taches":[{"id":1,"libelle_tache":"montage  porte   
  simple","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:41","updated_at":"2018-06-08 11:41:41","tarificationtache":[]},{"id":2,"libelle_tache":"tache 
  1","Tarif":null,"metier_id":1,"deleted_at":null,"created_at":"2018-06-08 
  11:41:55","updated_at":"2018-06-08 11:41:55","tarificationtache":[]},{"id":3,"libelle_tache":"tache 
  2","Tarif":null,"metier_id":2,"deleted_at":null,"created_at":"2018-06-08 
  11:42:01","updated_at":"2018-06-08 11:42:01","tarificationtache": 
  [{"id":1,"tarif":29.55,"tache_id":3,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-08 
 11:58:54","updated_at":"2018-06-08 11:58:54"}]},{"id":4,"libelle_tache":"tache 
 3","Tarif":null,"metier_id":3,"deleted_at":null,"created_at":"2018-06-08 
 12:00:15","updated_at":"2018-06-08 12:00:15","tarificationtache": 
[{"id":2,"tarif":55.12,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-08 
12:00:37","updated_at":"2018-06-08 12:00:37"}, 
{"id":3,"tarif":253,"tache_id":4,"technicien_id":1,"deleted_at":null,"created_at":"2018-06-15 
23:17:23","updated_at":"2018-06-15 23:17:23"}, 
{"id":4,"tarif":28.22,"tache_id":4,"technicien_id":2,"deleted_at":null,"created_at":"2018-06-20 
17:03:32","updated_at":"2018-06-20 17:03:32"}]}]}

saying that the average rating i perform in laravel with this functin

 public function show($id)
{
    $technicien = technicien::findOrFail($id);
    $notes = $technicien->avisinterventions->pluck('note');
    $moyenne = $technicien->avisinterventions()->avg('note');
    

    $user = $technicien->user;
    $metier = $technicien->metier;
    $tarificationtache = $technicien->tarificationtache;
    $zoneintervention = $technicien->zoneintervention;


    return view('technicien.show' , compact('technicien'))->with('user',$user)- 
   >with('metier',$metier)->with('zoneintervention',$zoneintervention)- 
   >with('tarificationtache',$tarificationtache)->with('moyenne',$moyenne);

}
20 Jun
5 months ago

chagouani left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

@Vilfago i have do it with combobox he shown relative 'tarifcationtache' to tache but i like to shown on table

chagouani left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

@vilfago this is the **find solution ** but i don't know how to impliment there with my code

<div class="modal-body">
//put your table in here
</div> 

After populate the table using this Javacript code

$.ajax({
type:'GET',
url:your_url,
dataType: 'json',
success:function(employee_list){
$table_body = $("#tbl_body_name");
$table_body.empty();

if (employee_list.length > 0) {
    div_no_data.style.display = 'none';
 $.each(employee_list, function (index, value) {
    $table_body.append('<tr class="deselected" 
 onclick="rowSelect(this)">' +
        '<td style="text-align: left;">' + value.technician_id  + 
 '</td>' +
        '<td style="text-align: left;">' + value.tache_id + '</td>' +
        '</tr>');
 });
}
 }
 });

Next use this function to get selected row information and set it to your desired dropdown

function rowSelect(currentRow){
//this is the code to set a dropdown menu using jquery
var technician_id = selectedRow.children[0].innerHTML;
$("#your_technician_dropdown_menu_id").val(technician_id);
}

chagouani left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

@Vilfago I find this code on the internet and I do not know how to integrate it into my work because it is my first project with laravel if you have a link that I can see or if you can help me to solve my problém please

chagouani left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

@Vilfago i have make table like this but he shown all tarificationtaches

<table class="table table-bordered bg-light">
        <thead class="bg-dark" style=" color: white">
                <tr>
                     <th class="light-table-filter" data-table="order-table" placeholder="Filter"    
   style=" color: #337ab7">technicien </th>
                     <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
   style=" color: #337ab7">Tache </th>
                    <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
   style=" color: #337ab7">tarif </th>
                    
                   
                    <th style="color: #337ab7" width="220px" style="vertical-align: 
        middle">Action</th>
                    
                </tr>
                </thead>
                <tbody>
                @foreach($tarifications as $tarifications)
                <tr>
                    <td>{{$tarifications->technciens}}</td>
                    <td>{{$tarifications->tache->libelle_tache}}</td>
                    <td>{{$tarifications->tarif}}</td>
                    
                    <td>
                        <form action="{{url ('tarifications/'.$tarifications->id)}}" method="post">
                            {{csrf_field()}}
                            {{method_field('DELETE')}}
                            <a href="{{url('tarifications/'.$tarifications->id.'/show')}}" 
     type="checkbox"  name ="action" value="" >choisir</a>
                            
                        </form>

                    </td>
                </tr>
                @endforeach
                </body>
            </table>

chagouani started a new conversation Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache'

I have a vieu that contion 2 combobox connect

we choose a 'metier' the list of 'tache' is displayed we choose a 'tache' I would like to display a table that contains the list of' tarificationtaches' that are the selected' tache' in the selectbox

iterventioncontroller

public function create()

{
    $client = client::orderBy('id', 'asc')->get();
    $metiers = metier::orderBy('id', 'asc')->get();
    $technicien = Technicien::orderBy('id', 'desc')->get();
    $tarifications = tarificationtache::orderBy('id', 'desc')->get();

    return view('intervention.create')->with('technicien', $technicien)->with('client',$client)- 
>with('metiers',$metiers)->with('tarifications',$tarifications);
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(InterventionRequest $request)
{
    $intervention = new Intervention();
    $intervention ->date_intervention =$request->input('date_intervention');
    $intervention ->description =$request->input('description');
    $intervention ->duree_prevu =$request->input('duree_prevu');
     if($request->has('statut')){
    $intervention->statut = $request->input('statut');
    }else{
           $intervention->statut = 0;
    }
    
    $intervention ->technicien_id = $request->input('technicien_id');
    $intervention ->client_id = $request->input('client_id');
    $intervention ->tarification_id = $request->tarification_id;
    $intervention->save();
    return redirect('intervention');




}

create.blade.php

     @extends('Layouts/app')
    @extends('Layouts/master')
 @section('content')
    <!--  jQuery -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
 <script type="text/javascript">
var getTachesByMetierUrl = "{{url('/tachesbymetier')}}";
    var getAdresseByClientUrl = "{{url('/adressebyclient')}}";
    var getTarificationsByTacheUrl = "{{url('/tarificationsbytache')}}";
    var getTechniciensByTarificationtacheUrl = "{{url('/techniciensbytarificationtache')}}";
    //console.log(getMetiersByTechnicienUrl,getTachesByMetierUrl 
    ,getTarificationsByTacheUrl);
    

    function getAdresseByClient(val) {
        if(val.length>0) {
            var client_id = val;
            $.get(getAdresseByClientUrl+'/'+client_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.adresses,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.code_postal+'</option>';
                });
                $('#adresses').html(html);

            });
        }
    }


    function getTachesByMetier(val) {
        if(val.length>0) {
            var metier_id = val;
            $.get(getTachesByMetierUrl+'/'+metier_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.taches,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.libelle_tache+'</option>';
                });
                $('#taches').html(html);

            });
        }
    }

     function getTechniciensByTache(val) {
        if(val.length>0) {
            var tache_id = val;
            $.get(getTechniciensByTacheUrl+'/'+tarificationtache_id,function(res) {
                var html = '<option value="">-Select-</option>' ;
                $.each(res.techniciens,function(index,item) {
                    html+='<option value="'+item.id+'">'+item.nom+'</option>';
                });
                $('#techniciens').html(html);

            });
        }
    }
 
   
    function rowSelect(currentRow){
        //this is the code to set a dropdown menu using jquery
        var technicien_id = selectedRow.children[0].innerHTML;
        $("#your_technicien_dropdown_menu_id").val(technicien_id);
    }




</script>



@if(count($errors))
    <div class="alert alert-danger" role="alert">
        <ul>
            @foreach($errors ->all() as $message)
                <li>{{$message}}</li>
            @endforeach
        </ul>
    </div>
@endif
<div class="container">
    <div class="row"></div>
    <div class="col-md-10">
        <h1>Ajout Intervention</h1>
        <form action=" {{url ('intervention')  }}" method="post">
            {{csrf_field()}}
            <div class="form-group">
                <label for="client">Client</label>
                <select onchange="getAdresseByClient(this.value)" name="client_id" id="client" 
 class="form-control">
                    <option value="">-Select-</option>
                    @foreach($client as $t)
                        <option value="{{$t->id }}">
                            {{$t->user->nom}}
                        </option>
                    @endforeach
                </select>
            </div>


            <div class="form-group">
                <label for="">date et heure </label>
                <input class="form-control" type="datetime-local"  name ="duree_prevu" value=" 
 {{old('duree_prevu')}}">
            </div>

            <div class="form-group">
                <label for="">description</label>
                <input type="text"  name ="description" class="form-control"value=" 
 {{old('description')}}">
            </div>

    <div class="form-group">
                <div class="col-md-12">
                <div class="col-md-4">
                <label>Metier: </label>
                <select onchange="getTachesByMetier(this.value)" style="width: 200px" 
  class="productm form-control" id="metiers">
               <option value="">-Select-</option>
                    @foreach($metiers as $t)
                        <option value="{{$t->id }}">
                            {{$t->libelle_metier}}
                        </option>
                    @endforeach
                </select>
            </div>

            <div class="col-md-4">
                <label>tache: </label>
                <select onchange="getTarificationsByTache(this.value)" style="width: 200px" 
  class="productname form-control" name="tache" id="taches">
                <option value="">-Select-</option>
                </select>
            </div>

            
</div>
            <div class="form-group">
                <div class="form-group">
                <label for="">statut    :   </label>
                <input type="checkbox"  name ="statut" value="1" required autofocus>
            </div>
            <div class="form-group">
                <label for="">payement</label>
                <input type="checkbox"  name ="payement" value="">
            </div>
            <div class="form-group">

                <input type="submit" value = "enregistrer" class="form-control btn btn-primary">
            </div>
</div>
</div>
</div>
<script>
     function getMessage(){
         $.ajax({
                  type:'GET',
                  url:your_url,
                  dataType: 'json',
                  success:function(tarifications_list){
                    $table_body = $("#tbl_body_name");
                    $table_body.empty();

                    if (tarifications_list.length > 0) {
                        div_no_data.style.display = 'none';
                        $.each(tarifications_list, function (index, value) {
                            $table_body.append('<tr class="deselected" onclick="rowSelect(this)">' +
                                '<td style="text-align: left;">' + value.technicien_id  + '</td>' +
                                '<td style="text-align: left;">' + value.tache_id + '</td>' +
                                '</tr>');
                        });
                    }
                  }
                });
     }
  </script>

    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"   
     rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-         
     datepicker.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap- 
    datepicker.js"></script>
@endsection

table tarificationtaches

 public function up()
{
    Schema::create('tarificationtaches', function (Blueprint $table) {
        $table->increments('id');
        $table->float('tarif', 8,2);
        $table->integer('tache_id')->unsigned();
        $table->foreign('tache_id')->references('id')->on('taches');
        $table->integer('technicien_id')->unsigned();
        $table->foreign('technicien_id')->references('id')->on('techniciens');
        $table->datetime('deleted_at')->nullable();
        $table->timestamps();
    });
}
18 Jun
5 months ago
15 Jun
5 months ago

chagouani left a reply on Get Id On Slect Box

@mballaag mais avec ce code j'ai plus d'erreur mais il m'affiche la liste de tous les metier pas les metier du technicien selectionné

controller

 public function create($technicien_id)   
{
    $technicien = technicien::orderBy('id','desc')->get();
    $taches = Tache::orderBy('libelle_tache', 'asc')->get();
    $metiers = Metier::orderBy('libelle_metier', 'asc')->get();
    return view('tarification.create')->with('taches', $taches)->with('technicien', 
    $technicien)->with('metiers', $metiers)->with('technicien_id', $technicien_id);
}

create.blade.php

<div class="form-group">
            <div class="col-md-12">
                    <div class="col-md-4">
            <label>Metier: </label>
            <select onchange="getTachesByMetier(this.value)" style="width: 
            200px" class="productm form-control" id="metiers">
                <option value="">-Select-</option>
            @foreach($metiers as $metier)
                  <option value={{$metier->id}}>{{$metier->libelle_metier}}</option>
            @endforeach
           </select>
        </div>

chagouani left a reply on Get Id On Slect Box

@mballaag maintenant j'ai afficher la liste des technicien puis j'ai appuier suer le bouton ajouter tarification pour accceder à notre interface tarification tache j'ai us cette erreur

"Trying to get property of non-object (View: 
    C:\xampp\htdocs\projet\resources\views\tarification\create.blade.php)" 

et voila le fichier log

[2018-06-15 23:07:06] local.ERROR: Trying to get property of non-object (View: C:\xampp\htdocs\projet\resources\views\tarification\create.blade.php) {"exception":"[object] (ErrorException(code: 0): Trying to get property of non-object (View: C:\xampp\htdocs\projet esources\views\tarification\create.blade.php) at C:\xampp\htdocs\projet\storage\framework\views\693a3f0d31735a2b8d627760cad9675360196a8e.php:74, ErrorException(code: 0): Trying to get property of non-object at C:\xampp\htdocs\projet\storage\framework\views\693a3f0d31735a2b8d627760cad9675360196a8e.php:74) [stacktrace] #0 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\Engines\PhpEngine.php(45): Illuminate\View\Engines\CompilerEngine->handleViewException(Object(ErrorException), 1) #1 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\Engines\CompilerEngine.php(59): Illuminate\View\Engines\PhpEngine->evaluatePath('C:\\xampp\\htdocs...', Array) #2 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\View.php(137): Illuminate\View\Engines\CompilerEngine->get('C:\\xampp\\htdocs...', Array) #3 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\View.php(120): Illuminate\View\View->getContents() #4 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\View.php(85): Illuminate\View\View->renderContents() #5 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Http\Response.php(42): Illuminate\View\View->render() #6 C:\xampp\htdocs\projet\vendor\symfony\http-foundation\Response.php(201): Illuminate\Http\Response->setContent(Object(Illuminate\View\View)) #7 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(724): Symfony\Component\HttpFoundation\Response->__construct(Object(Illuminate\View\View)) #8 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(698): Illuminate\Routing\Router::toResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View)) #9 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(658): Illuminate\Routing\Router->prepareResponse(Object(Illuminate\Http\Request), Object(Illuminate\View\View)) #10 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #11 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #12 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure)) #13 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #14 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken.php(67): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #15 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure)) #16 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #17 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\View\Middleware\ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #18 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #19 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #20 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Session\Middleware\StartSession.php(63): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #21 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure)) #22 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #23 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #24 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure)) #25 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #26 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Cookie\Middleware\EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #27 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure)) #28 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #29 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #30 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(660): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #31 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(635): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request)) #32 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(601): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route)) #33 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Router.php(590): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request)) #34 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request)) #35 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request)) #36 C:\xampp\htdocs\projet\vendor\fideloper\proxy\src\TrustProxies.php(56): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #37 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure)) #38 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #39 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #40 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #41 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #42 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #43 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure)) #44 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #45 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #46 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure)) #47 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #48 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #49 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure)) #50 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #51 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request)) #52 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Foundation\Http\ Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #53 C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\ Foundation\Http\Kernel.php(116): Illuminate\Foundation\Http\Kernel- >sendRequestThroughRouter(Object(Illuminate\Http\Request)) #54 C:\xampp\htdocs\projet\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request)) #55 {main} "}

chagouani left a reply on Get Id On Slect Box

@mballaag

[2018-06-14 13:33:53] local.ERROR: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'technicien_id' in 'where clause' (SQL: select * from metiers where technicien_id = 2 and metiers.deleted_at is null order by libelle_metier asc) {"exception":"[object] (Illuminate\Database\QueryException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'technicien_id' in 'where clause' (SQL: select * from metiers where technicien_id = 2 and metiers.deleted_at is null order by libelle_metier asc) at C:\xampp\htdocs\projet\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664, Doctrine\DBAL\Driver\PDOException(code: 42S22): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'technicien_id' in 'where clause' at C:\xampp\htdocs\projet\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:79