/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $devis = Devis::with('societe', 'contact', 'gescom')->where('etat_devis', 1)->orderBy('created_at', 'desc')->get();
     $actif = 'gescom';
     $type = 0;
     $tri = 'aucun';
     return view('gescom.docs', compact('actif', 'devis', 'type', 'tri'));
 }
 /**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $actif = 0;
     $preference = Preference::first();
     $notes = Note::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $contacts = Contact::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $societes = Societe::where('etat', 1)->orderBy('created_at', 'desc')->paginate(5);
     $devis = Devis::where('etat_devis', 1)->orderBy('created_at', 'desc')->paginate(5);
     return view('accueil', compact('actif', 'preference', 'notes', 'contacts', 'societes', 'devis'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  *
  * @return Response
  */
 public function edit(Devis $devis, $table_id, $field_id)
 {
     $table = Table::findOrFail($table_id);
     $field = Field::findOrFail($field_id);
     $firstField = $devis->tables()->where('id', $table->id)->first()->fields->first();
     $tableList = $devis->tables()->get();
     $fieldList = $table->fields()->get();
     $fieldTypeList = FieldType::all()->lists('name', 'id');
     $fakerList = [];
     //$tableList = Table::lists('model');
     return view('admin.field.edit', compact('field', 'tableList', 'devis', 'table', 'fieldList', 'firstField', 'fieldTypeList', 'fakerList'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $profil = Devis::with('gescom', 'societedata')->findOrfail($request->input('id'));
     foreach ($profil->modules as $key => $value) {
         $produit_id = $value->pivot->produit_id;
     }
     $produit = Produit::findOrFail($produit_id);
     $produits = $produit->modules;
     // var_dump($profil);
     // var_dump($produits);
     $cle = $request->input('cle');
     $mac = $request->input('mac');
     $dv_prefix = $produit->prefix_produit;
     $dv_suffix = $produit->suffix_produit;
     $livraison_number = DB::table('livraisons')->select('num_bl')->where('num_bl', 'like', '%BL-' . $dv_prefix . '%')->orderBy('id', 'desc')->first();
     if (empty($livraison_number)) {
         $num_bl = 'BL-' . $dv_prefix . '-' . date('y') . date('m') . $dv_suffix;
     } else {
         foreach ($livraison_number as $blvalue) {
             $last_bl_number = $blvalue;
         }
         $lg = strlen('BL-' . $dv_prefix . '-') + 4;
         $inc_lv_number = substr($last_bl_number, $lg) + 1;
         $num_bl = 'BL-' . $dv_prefix . '-' . date('y') . date('m') . $inc_lv_number;
     }
     $societedata = DB::table('societedatas')->select('id')->orderBy('created_at', 'desc')->first();
     $data = ['num_bl' => $num_bl, 'devis_id' => $profil->id, 'num_cle' => $cle, 'num_mac' => $mac, 'suivi_bl' => $profil->suivi_devis, 'destinataire' => $profil->nom_scliente, 'adresse_dest' => $profil->adresse_scliente, 'pays_dest' => $profil->pays_clt, 'ville_dest' => $profil->ville_clt, 'tel_dest' => $profil->tel_clt, 'ref_dest' => $profil->ref_client, 'num_cmd' => $profil->num_devis, 'livraison_modal' => $num_bl, 'contact_dest' => $profil->nom_scontact, 'societedata_id' => $societedata->id, 'fax_dest' => $profil->fax_clt, 'email_dest' => $profil->email_clt, 'url_dest' => $profil->url_clt, 'nom_produit' => $profil->produit, 'echeance' => $profil->echeance_devis, 'total_ht' => $profil->total_ht, 'total_anpme' => $profil->total_anpme, 'total_part' => $profil->total_part, 'gescom_id' => $profil->gescom_id, 'contact_id' => $profil->contact_id, 'societe_id' => $profil->societe_id];
     $livraison = Livraison::create($data);
     $modules = $profil->modules;
     foreach ($modules as $value) {
         $livraison->modules()->attach($value->pivot->module_id, ['quantite' => $value->pivot->produit_quantite, 'produit_id' => $value->pivot->produit_id, 'service_duree' => $value->pivot->service_duree]);
     }
     $id = $livraison->id;
     return redirect()->route('livraison.show', $id);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $devis = Devis::findOrFail($id);
     $devis->update(['etat_devis' => 0]);
     return redirect(route('gescom.index'));
 }
@extends('layouts.admin')

@section('content')

<div class=" alert alert-info"><b>Pour modifier cette Page</b><br>organit > resources/views/admin/cheatsheet/dev_cheatsheet_Vue</div>



<h2>Passer variable PHP a vue.js</h2>
<pre>
	<?php 
$devis = \App\Devis::find(22);
?>

	<bootstrapping :devis="{{$devis}}"></bootstrapping>


	....

    props :{
		devis:{
			required: false,
			type:Object,
			}
    },

</pre>



Exemple #7
0
 public function createTableRelation($request, $model, $toModel)
 {
     $devis = Devis::find($request->devis_id);
     switch ($request->laravel_name) {
         case 'hasMany':
             echo "hasMany<br>";
             $model->create_hasMany_relation_with($request, $toModel);
             break;
         case 'belongsTo':
             echo "belongsTo<br>";
             $model->create_belongsTo_relation_with($request, $toModel);
             break;
         case 'belongsToMany':
             echo "belongsToMany<br>";
             $model->create_belongsToMany_relation_with($request, $toModel);
             break;
         case 'hasOne':
             echo "hasOne<br>";
             # code...
             break;
         case 'morphedByMany':
             echo "morphedByMany<br>";
             # code...
             break;
         case 'morphToMany':
             echo "morphToMany<br>";
             # code...
             break;
         default:
             # code...
             break;
     }
 }
 public function list_pointages(Request $request, Devis $devis)
 {
     $pointages = $devis->pointages()->orderBy('id', 'desc')->get();
     $mode = 'edit';
     $sumPointagePerType = $devis->sumPointagePerType();
     return view('admin.devis.edit', compact('pointages', 'devis', 'mode', 'sumPointagePerType'));
 }
 public function generate_bootstrapping(Devis $devis)
 {
     return $devis->generate_bootstrapping();
     //dd('bootstrapping Files successfully Generated in /uploads/'.$devis->id);
     //Flash::success('bootstrapping Files successfully Generated in /uploads/'.$devis->id);
     //return redirect()->route('admin.devis.edit',[$devis->id]);
 }