chagouani

Experience

3,680

0 Best Reply Awards

  • Member Since 3 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

22nd June, 2018

chagouani left a reply on Json • 21 hours ago

@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 • 22 hours ago

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"}]}]}

21st June, 2018

chagouani started a new conversation Json Function To Shown Name And Avg Note • 1 day ago

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 • 1 day ago

chagouani left a reply on Json • 1 day ago

@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' • 1 day ago

@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 • 1 day ago

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

chagouani left a reply on JSON • 1 day ago

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

chagouani started a new conversation JSON • 1 day ago

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);

}

20th June, 2018

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

@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' • 2 days ago

@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' • 2 days ago

@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' • 2 days ago

@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 left a reply on Display Table Where 'tache_id' On Table 'tarificationtache' Equal The Values Of Select Box' Id' From Table 'tache' • 2 days ago

@Vilfago I tried with the ajax code to display the table but nothing is displayed

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

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();
    });
}

18th June, 2018

chagouani left a reply on How To Get "ajax" Table From Dynamic Data Whith ("jQuery") • 4 days ago

@mballaag peut tu m'aider a résoudre ça

15th June, 2018

chagouani left a reply on Get Id On Slect Box • 1 week ago

@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 • 1 week ago

@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 • 1 week ago

@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

14th June, 2018

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballag object(Illuminate\Database\Eloquent\Collection)#121 (1) { ["items":protected]=> array(1) { [0]=> object(App\metier)#361 (27) { ["guarded":protected]=> array(0) { } ["dates":protected]=> array(1) { [0]=> string(10) "deleted_at" } ["connection":protected]=> string(5) "mysql" ["table":protected]=> NULL ["primaryKey":protected]=> string(2) "id" ["keyType":protected]=> string(3) "int" ["incrementing"]=> bool(true) ["with":protected]=> array(0) { } ["withCount":protected]=> array(0) { } ["perPage":protected]=> int(15) ["exists"]=> bool(true) ["wasRecentlyCreated"]=> bool(false) ["attributes":protected]=> array(5) { ["id"]=> int(3) ["libelle_metier"]=> string(8) "metier 2" ["deleted_at"]=> NULL ["created_at"]=> string(19) "2018-06-08 11:41:36" ["updated_at"]=> string(19) "2018-06-08 11:41:36" } ["original":protected]=> array(5) { ["id"]=> int(3) ["libelle_metier"]=> string(8) "metier 2" ["deleted_at"]=> NULL ["created_at"]=> string(19) "2018-06-08 11:41:36" ["updated_at"]=> string(19) "2018-06-08 11:41:36" } ["changes":protected]=> array(0) { } ["casts":protected]=> array(0) { } ["dateFormat":protected]=> NULL ["appends":protected]=> array(0) { } ["dispatchesEvents":protected]=> array(0) { } ["observables":protected]=> array(0) { } ["relations":protected]=> array(0) { } ["touches":protected]=> array(0) { } ["timestamps"]=> bool(true) ["hidden":protected]=> array(0) { } ["visible":protected]=> array(0) { } ["fillable":protected]=> array(0) { } ["forceDeleting":protected]=> bool(false) } } }

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag j'ai modifier le model et j'ai l'aisser la vue et le controller comme suite

<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>

cotroller

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

j'ai u ce message d'erreur

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

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag nn la table intermédiaire entre metier et technicien 'technicien_metier'

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag

pas grave je vous remercie pour le temps que vous m'avais sacré

"SQLSTATE[42S22]: Column not found: 1054 Unknown column 
'technicien_zone.metier_id' in 'where clause' (SQL: select * from `metiers` where 
exists (select * from `techniciens` inner join `technicien_zone` on `techniciens`.`id` 
= `technicien_zone`.`technicien_id` where `metiers`.`id` = 
`technicien_zone`.`metier_id` and `id` = 2 and `techniciens`.`deleted_at` is null) 
and `metiers`.`deleted_at` is null order by `libelle_metier` asc) ◀"    

chagouani left a reply on Get Id On Slect Box • 1 week ago

"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'techniciens' in 'where 
clause' (SQL: select * from `metiers` where `techniciens` = (select * where `id` = 2) 
and `metiers`.`deleted_at` is null order by `libelle_metier` asc) ◀"

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag

"Missing argument 2 for 
    App\Http\Controllers\TarificationController::App\Http\Controllers\{closure}()"

chagouani left a reply on Get Id On Slect Box • 1 week ago

"Parse error: syntax error, unexpected ';', expecting ',' or ')'"

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag le nom du champ est comme dans le code et quand je suprime where j'ai cette erreur

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

et entre metier et technicien j'ai une relation many to many comme ceci

model metier

 public function techniciens()
{
    return $this- 
    >belongsToMany('App\technicien','technicien_zone','metier_id','technicien_id');

}

model technicien

public function metier()
{
    return $this- 
>belongsToMany('App\metier','technicien_metier','technicien_id','metier_id');

}

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag when i have change like this i have this erreur

"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) 

this is my view

<div class="form-group">
            <div class="col-md-12">
                    <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>

13th June, 2018

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag j'ai 2 interface la 1er affiche la liste des technicien avec un bouton ajouter tarification car chaque technicien à plusieurs tarification quand on appui sur le bouton ajouter tarification pour un technicien sélectionné dans la 1er interface elle nous redirige vers une interface qui contient des Select box relative ('technicien'->'metier'->'tache') le technicien doit être sélectionné automatiquement Mon problème maintenant c'est que l'interface tarification affiche le technicien automatiquement mais e sélect box n'affiche rien et si je sélectionne manuellement un technicien il affiche ses metier

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag and i have this function on metier controller

 public function getMetiersByTechnicien($technicien_id)
{

    $t = technicien::find($technicien_id);
    return response()->json(['metiers' => $t->metier]);
}

chagouani left a reply on Get Id On Slect Box • 1 week ago

this is the function to return create.blade.php

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

12th June, 2018

chagouani left a reply on Get Id On Slect Box • 1 week ago

the same think he token on technicien id the id automatically but the next select box I receive it empty

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag can you explane more please

chagouani left a reply on Get Id On Slect Box • 1 week ago

@mballaag where I have to put one of the 2 lines

chagouani started a new conversation Get Id On Slect Box • 1 week ago

I have 2 interface the first to create a "technicien" the 2nd it's given him a "tarification" of hit "tache" so after finishing to create our technicien button validate us rederict to the interface tarifciation which takes as parameter id techncien_id automatically on à dynamic combobox

I managed to recover technicien_id but my problem is that I have relative combobox in the 2nd interface so I have to reselected the technician to take the technicien_id

tarificationcontroller.php

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

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-"' ; $.each(res.metiers,function(index,item) { html+=''+item.libelle_metier+''; }); $('#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>
       </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

route.php

Route::get('tarification/create/{technicien_id?}', 
    '[email protected]');

chagouani left a reply on Get Id Automatically • 1 week ago

@tykus can you help me please

chagouani left a reply on "SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column 'clients.avis_intervention_id' In 'where Clause' (SQL: Select * From `clients` Where `clients`.`avis_intervention_id` In (1) And `clients`.`deleted_at` Is Null) • 1 week ago

public function client()
{
    return $this->hasOne(Client::class);
}

public function avis()
{
    return $this->hasOne(AvisIntervention::class);
}

chagouani started a new conversation "SQLSTATE[42S22]: Column Not Found: 1054 Unknown Column 'clients.avis_intervention_id' In 'where Clause' (SQL: Select * From `clients` Where `clients`.`avis_intervention_id` In (1) And `clients`.`deleted_at` Is Null) • 1 week ago

i have 3 tables ('avis_intervention' = id , client_id , intervention_id, note ) ('client' = id , user_id ) ('user' =nom , prénom .....)

in my interface index.blade.php to affiche the list of avis_intervention when i shown client_id it work but when i shown the name of client whith this code i have a problém

index.blade.php

@extends('Layouts.app')
@extends('Layouts.master')
@section('css')
<style>
    a, a:hover {
        color: white;
    }
</style>

@endsection
@section('content')
<div class="container">
    <div class="col-md-10">
    <div class="float-right">
        
    </div>
     <h1> Liste  Avis Intervention</h1>
    <hr/>
    
    <div class="row">
        <div class="col-sm-5 form-group">
            
        </div>
        <div class="col-sm-7 form-group">
             <div class="pull-right">
                <a href="{{url('avis/create')}}" class="btn btn-primary">Nouvelle Avis</a>
            </div>
        </div>
        
    </div>                           
    
    <table class="table table-bordered bg-light">
    <thead class="bg-dark" >
                            <tr >
                                <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
style=" color: #337ab7">Client</th>
                                <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
style=" color: #337ab7">qualité</th>
                                <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
 style=" color: #337ab7">nbr_heure</th>
                                <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
 style=" color: #337ab7">service</th>
                                <th class="light-table-filter" data-table="order-table" placeholder="Filter" 
 style=" color: #337ab7">note</th>
                                <th style="color: #337ab7" width="220px" style="vertical-align: 
 middle">action</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($avis as $avis)
                                <tr>
                                    <td>{{$avis->client->user->nom}}</td>
                                    <td>{{$avis->qualité}}</td>
                                    <td>{{$avis->nbr_heure}}</td>
                                    <td>{{$avis->service}}</td>
                                    <td>{{$avis->note}}</td>

                                    <td >
                    <form action="{{url ('avis/'.$avis->id)}}" 
                          method="post" >
                        <a class="btn btn-default btn-sm" title="Edit"
                           href="{{url('avis/'.$avis->id.'/show')}}">
                            Details</a>
                        <a class="btn btn-primary btn-sm" title="Edit"
                           href="{{url('avis/'.$avis->id.'/edit')}}">
                            Editer</a>
                        <input type="hidden" name="_method" value="delete"/>
                        {{csrf_field()}}
                        <a class="btn btn-danger btn-sm" title="Delete"
                           href="javascript:if(confirm('Are you sure want to delete?')) $('#frm_{{$avis- 
 >id}}').submit()">
                            Supprimer
                        </a>
                    </form>
                </td>
                                </tr>
                                @endforeach
                            </tbody>
                        </table>
                        <!-- /.table-responsive -->

                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>


@endsection

avis_intervention_controller

<?php
 namespace App\Http\Controllers;
 use App\AvisIntervention;
use Illuminate\Http\Request;
use App\Intervention;
use App\Client;
class Avis_InterventionController extends Controller

{ public function index() {

    $Listavis=AvisIntervention::with(['client'])->get();
    return view('avis.index',['avis'=>$Listavis]);
}

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



    $intervention = intervention::orderBy('id','desc')->get();
    $client = client::orderBy('id', 'desc')->get();
    return view('avis.create')->with('intervention', $intervention)->with('client', $client);
}

/**
 *
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
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');

}

/**
 * Display the specified resource.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function show($id)
{
    $avis=AvisIntervention::find($id);
    return view('avis.show',['avis'=>$avis]);
}

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

/**
 * Update the specified resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function update(Request $request, $id)
{
    $avis=AvisIntervention::find($id);
    $client=client_id::find($id);
    $intervention=intervention_id::find($id);
    $avis ->qualité =$request->input('qualité');
    $avis ->nbr_heure =$request->input('nbr_heure');
    $avis ->service =$request->input('service');
    $avis ->client_id =$request->input('client_id');
    $avis ->intervention_id =$request->input('intervention_id');
    $avis->save();
    return redirect('intervention');
}

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

11th June, 2018

chagouani left a reply on Json • 1 week ago

public function getTarification(){

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

}

chagouani started a new conversation Json • 1 week ago

i have 3 table 'metiers=> id ,libelle-metier ' 'taches=>id , libelle_tache , metier_id ' and 'tarificationtaches=> id , tarif, tache_id , techncien_id '

I have 2 relative combobox 1 to choose a 'metier' and the 2nd to choose a 'taches' relative to the chosen 'metier' then I would like a function json to get list of tarificationtache where 'tarificationtache':tache_id = id of the selected tache

chagouani left a reply on PHP Fatal Error: Cannot Declare Class CreateAdressesTable • 1 week ago

@tykus thank you for your answer but my problem that the migration is generate 2 times that's why it shows me this message.

chagouani started a new conversation Get Id Automatically • 1 week ago

I have 2 interface the first to create a "technicien" the 2nd it's given him a "tarification" of hit "tache" so after finishing to create our technicien button validate us rederige to the interface tarifciation which takes as parameter id techncien_id automatically on à dynamic combobox

I managed to recover id but my problem is that I have relative combobox in the 2nd interface so I have to reselected the technician to take the technicien_id

tarificationcontroller

<?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 = null)   
{
    $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');  }

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>
           </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="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

route.php

  Route::get('tarification/create/{technicien_id?}', 
  '[email protected]');

8th June, 2018

chagouani started a new conversation Get Id Automatically • 2 weeks ago

I have 2 interface the first to create a "technicien" the 2nd it's given him a "tarification" of hit "tache" so after finishing to create our technicien button validate us rederige to the interface tarifciation which takes as parameter id techncien_id automatically

I managed to recover id but my problem is that I have relative combobox in the 2nd interface so I have to reselected the technician to take the technicien_id

tarificationcontroller

<?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 = null)   
{
    $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');  }

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>
           </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="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

route.php

  Route::get('tarification/create/{technicien_id?}', 
  '[email protected]');

chagouani started a new conversation PHP Fatal Error: Cannot Declare Class CreateAdressesTable • 2 weeks ago

i like to change my table to add libelle_code on table zoneinterventionsi have added on migration but when i make megration i have this erreurs

C:\xampp\htdocs\projet>php artisan migrate
    PHP Fatal error:  Cannot declare class CreateAdressesTable, because the name is already 
    in use in 
    C:\xampp\htdocs\projet\database\migrations18_04_03_090601_create_adresses_table 
    .php on line 37
     In 2018_04_03_090601_create_adresses_table.php line 37:

     Cannot declare class CreateAdressesTable, because the name is already in use

**migration table

<?php

  use Illuminate\Database\Migrations\Migration;
  use Illuminate\Database\Schema\Blueprint;

  class CreateZoneinterventionsTable extends Migration {

/**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::create('zoneinterventions', function(Blueprint $table)
    {
        $table->increments('id');
        $table->integer('code_postal');
        $table->string('libelle_code');
        $table->softDeletes();
        $table->timestamps();
    });
}


/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::drop('zoneinterventions');
}

   }

chagouani left a reply on Json • 2 weeks ago

Missing argument 1 for App\Http\Controllers\TechnicienController::GetTables()"

chagouani started a new conversation Json • 2 weeks ago

I have 2 table technicien(id, user_id,actif) and user (nom , prenom , adresse )

I would like to perform a web service function to display the technician list with their name and firstname of the user table

i have this function but it displays all techiciens i like to shown information of selected id

public function GetTables() {
    $techniciens = Technicien::with('user')->get();

    return $techniciens->map(function ($technicien) {
    return [
        'id' => $technicien->id,
        'actif' => $technicien->actif,
        'moyenne_avis' => $technicien->moyenne_avis,
        'nom' => $technicien->user->nom,
        'prenom' => $technicien->user->prenom,
        'adresse' => $technicien->user->adresse,
    ];
  });
  }
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.