Syntax error or access violation: 1305 FUNCTION projet2.input does not exist

Posted 4 months ago by chagouani

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

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.