<?php

namespace App\Http\Controllers;

use App\DataTables\PayementDataTable;
use App\Models\Payement;
use Illuminate\Http\Request;

class PayementController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(PayementDataTable $dataTable)
    {
        return $dataTable->render('payements.index');
    }



    /**
     * Display the specified resource.
     *
     * @param  \App\Models\Payement  $payement
     * @return \Illuminate\Http\Response
     */
    public function show(Payement $payement)
    {
        if($payement->booking)return view('payements.print',['payement'=>$payement]);
        return view('payements.print_bording',['payement'=>$payement]);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Models\Payement  $payement
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Payement $payement)
    {
        $payement->status = Payement::STATUS_SUCCESS;
        return $payement->save();
    }

}
