PhoeniX5

PhoeniX5

Member Since 1 Year Ago

Experience Points
4,060
Total
Experience

940 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

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

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

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

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    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 Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

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

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

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

Level 1
4,060 XP
Sep
29
1 month ago
Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

Thanks, I figured out that in order to work, the arguments checked must be the same as those created, like this :

Production::firstOrCreate(
    [
        'produit_id' => $produit->produit_id,
        'production_designation' => $request->production_designation . ' ' .date('d-m-Y')
    ],
    [
        'produit_id' => $produit->produit_id,
        'production_designation' => $request->production_designation . ' ' .date('d-m-Y'),
        'produit_qte' => $request->produit_qte,
        'object_day' => $request->object_day
    ]
);
Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

It's weird issue, can't see what I'm doing wrong ?

Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

Here is my code :

function Creation_production(Request $request)
    {
       ...
        $produit = Produit::where('produit_designation', $request->produit)->first();
        Production::firstOrCreate(
            ['produit_id' => $produit->produit_id, 'production_designation' => $request->production_designation],
            ['produit_id' => $produit->produit_id, 'production_designation' => $request->production_designation . '  ' . date('d-m-Y'), 'produit_qte' => $request->produit_qte, 'object_day' => $request->object_day]
        );
        $success_output = 'Production ajouté';
        $output = array(
            'error'     =>  $error_array,
            'success'   =>  $success_output
        );
        echo json_encode($output);
    }

The only issue is that the $request->production_designation . ' ' . date('d-m-Y') is running like $request->production_designation the date is not being inserted!

Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

I already have it :

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Produit extends Model
{
    protected $fillable = [
        'produit_id', 'produit_designation',
    ];
}

Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

I get this message :

message: "SQLSTATE[HY000]: General error: 1364 Field 'produit_designation' doesn't have a default value (SQL: insert into `Produit` (`updated_at`, `created_at`) values (2020-09-29 08:32:06, 2020-09-29 08:32:06))"
Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

@michaloravec sorry if I was not clear enought, the problem is not that the record is not inserted in the database, all the records are inserted but without the date when :

dd($request->product_designation . ' ' . date ('d-m-Y'));

xxxxx 29-09-2020

but when inserting the record in the database, it only inserts xxxxx!

Activity icon

Replied to Can't Insert Date In Varchar Mysql Table!

@automica sorry for late reply, even with that still the same issue!

Sep
23
1 month ago
Activity icon

Started a new Conversation Can't Insert Date In Varchar Mysql Table!

Hello, I have an issue when trying to insert data in MySQL table, here is my code :

dd($request->produit_designation.' '.date('d-m-Y'));
Produit::firstOrCreate(['produit_designation' => $request->produit_designation], ['produit_designation' => $request->produit_designation.'  '.date('d-m-Y'));

when dd it shows the requested value + the current date but after inserting it only inserts the value without the date ?

Aug
17
2 months ago
Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

I gave up on using session()->flash and used back return redirect()->route('stuff.show', ['id' => $ id])->withInput(); from my previous question which seems to work fine, the only problem was while getting data with foreach I had to change {{$mat_aff->type_designation}} to {{$mat_aff['type_designation']}} but after that it works thanks.

Aug
13
2 months ago
Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

I don't know why this is happening or how can I do it otherwise ? because all other variables are submitted the same way as $mat_res and they don't cause any error even after refresh, here is the full code of the methods :

 public function createRest(Request $request)
    {
        $personnel = DB::table('Personnels')->where('Personnels.nom_prenom', $request->personnel)->first();
        $fonction_id = DB::table('Fonctions')->where('Fonctions.fonction_id', $personnel->fonction_id)->first();
        $structure = DB::table('Structures')->where('Structures.structure_id', $personnel->structure_id)->first();
        $rest = DB::table('Restitutions')->orderBy('created_at', 'desc')->where('Restitutions.mois', date('m'))->first();
        if (empty($rest)) {   
            $num = 1;
        }
        else {
            $num = $rest->num + 1;
        }
        $mat_res = array();
        for ($i = 0; $i < count(explode(',', $request->mat_for_rest)); $i++) {
            if(($request->mat_for_rest)[$i] != "") {
                $check_num = Restitution::where('mat_code', explode(',', $request->mat_for_rest)[$i])->where('personnel_id', $personnel->id)->first();
                //Restitution::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id, 'num' => $num, 'mois' => date('m'), 'restitution_code' => $num . "/" . date('m') . "/" . date("Y"), 'note' => $request->note, 'user_id' => $request->user_id]);
                //Materiel::where('mat_code', '=', explode(',', $request->mat_for_rest)[$i])->update(array('mat_etat' => 2));
                Journal_etat_materiel::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'date' => date('Y-m-d H:i:s')], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'note' => $request->note]);
                $mat_res[$i] = DB::table('Materiels')->join('Types', 'Materiels.type_id', '=', 'Types.type_id')->select('Types.type_designation', 'Materiels.mat_designation', 'Materiels.mat_description', 'Materiels.mat_ns', 'Materiels.note')->where('mat_code', explode(',', $request->mat_for_rest)[$i])->first();
            }
        }
        $nom = $request->personnel;
        //$service    = $request->service;
        $imei1      = $request->imei1;
        $imei2      = $request->imei2;        
        $fonction   = $fonction_id->fonction_designation . ' ' . $structure->structure_designation;
        $remarque   = $request->remarque;        
        if(empty($check_num)) {
            $rest_code  = $num . "/" . date('m') . "/" . date("Y");
        }
        else {
            $rest_code  = $num-1 . "/" . date('m') . "/" . date("Y");
        }
        session()->flash('nom', $nom);
        session()->flash('imei1', $imei1);
        session()->flash('imei2', $imei2);
        session()->flash('fonction', $fonction);
        session()->flash('remarque', $remarque);
        session()->flash('mat_res', $mat_res);
        
        //return view('Restitution', compact('nom', 'fonction', 'imei1', 'imei2', 'remarque', 'rest_code'), ['mat_res' => $mat_res]);
        //return redirect()->route('Restituter.restImpr', ['nom' => $nom, 'fonction'  => $fonction, 'imei1'  => $imei1, 'imei2'  => $imei2, 'remarque' => $remarque, 'rest_code'  => $rest_code, 'mat_res' => $mat_res])->withInput();
        return redirect()->route('Restituter.restImpr');//Session::get('data'); in view
    }

    public function restImpr(Request $request)
    {
        $nom        =  session()->get('nom');
        $imei1      =  session()->get('imei1');
        $imei2      =  session()->get('imei2');        
        $fonction   =  session()->get('fonction');
        $remarque   =  session()->get('remarque');
        $rest_code  =  session()->get('rest_code');
        $mat_res    =  session()->get('mat_res');
        //dd($mat_res);
        return view('Restitution', compact('nom', 'fonction', 'imei1', 'imei2', 'remarque', 'rest_code', 'mat_res'));
    }
Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

Here is the full behavior :

After more tests it seems that @dd($mat_res) returns (even after refreshing) :

array:1 [▼
  0 => {#239 ▼
    +"type_designation": "Câble d'alimentation"
    +"mat_designation": "DIAMOND"
    +"mat_description": "LD-96W"
    +"mat_ns": "LD-AC96W"
    +"note": "Nouveau matériel"
  }
]

when commenting @dd($mat_res) it works and displays the data correctly after one refresh it shows the error :

ErrorException {#250 ▼
  #message: "Invalid argument supplied for foreach()"
  #code: 0
  #file: "C:\Users\...\Documents\Gestion SI\Gestion_SI - backup\storage\framework\viewsa34a4a0cbc39e06cbe12ff2445e1b3df1bd1833.php"
  #line: 267
  #severity: E_WARNING
}

Which seems to be a caused by a null value of the $mat_res when @dd($mat_res) it shows null

Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

it's really weird when @dd($mat_res) it shows :

array:1 [▼
  0 => {#239 ▼
    +"type_designation": "Câble d'alimentation"
    +"mat_designation": "DIAMOND"
    +"mat_description": "LD-96W"
    +"mat_ns": "LD-AC96W"
    +"note": "Nouveau matériel"
  }
]

but after refresh it shows null

Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

Everything works as wanted when removing the foreach part all the data is displayed in the view and sumbitted only one time in the database even after refresh, here is the full blade file :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta content="fr" http-equiv="Content-Language" />
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
	<title>SARL Raylan Direction des systèmes</title>
	<script src="/js/jquery.min.js"></script>
	<link rel="stylesheet" href="/css/bootstrap.min.css" />
	<script src="/js/bootstrap.min.js"></script>
	<link rel="apple-touch-icon" sizes="76x76" href="../assets/img/apple-icon.png">
	<link rel="icon" type="image/svg" href="../assets/img/favicon-raylan.svg">
	<style type="text/css">
		.auto-style1 {
			border-style: solid;
			border-width: 1px;
			border-collapse: collapse;
		}

		.auto-style2 {
			font-family: Calibri;
			font-size: small;
			border: 1px solid #000000;
			text-align: center;
		}

		.auto-style3 {
			text-align: center;
			border: 1px solid #000000;
		}

		.auto-style4 {
			font-family: Calibri;
		}

		.auto-style5 {
			margin-left: 50px;
		}

		.auto-style6 {
			font-family: Calibri;
			background-color: #FFFFFF;
			font-size: 16pt;
		}

		.auto-style7 {
			border-collapse: collapse;
			font-size: 10.0pt;
			font-family: "Times New Roman", serif;
			border-style: none;
			border-color: inherit;
			border-width: medium;
		}

		.auto-style10 {
			font-size: 16pt;
			font-family: Calibri;
			text-align: left;
			font-weight: bold;
			margin-left: 0cm;
			margin-right: 0cm;
			margin-top: 0cm;
			margin-bottom: 6.0pt;
		}

		.auto-style11 {
			text-align: center;
		}

		.auto-style12 {
			font-family: Calibri;
			font-weight: bold;
			text-align: center;
			font-size: large;
		}

		footer {
			position: fixed;
			height: 50px;
			//background-color: red;
			bottom: 0px;
			left: 0px;
			right: 0px;
			margin-bottom: 0px;
		}

		.auto-style14 {
			font-family: Calibri;
			font-size: large;
		}

		.auto-style15 {
			font-size: large;
		}

		.auto-style17 {
			text-align: center;
			font-size: 16pt;
		}

		.auto-style22 {
			font-family: Calibri;
			font-size: x-large;
		}

		.auto-style24 {
			font-family: Calibri;
			font-size: 16pt;
		}

		.auto-style25 {
			font-size: 16pt;
		}

		.auto-style26 {
			font-family: Calibri;
			font-weight: bold;
			font-size: 16pt;
		}

		.auto-style29 {
			font-family: Calibri;
			font-size: 16pt;
			text-align: center;
		}

		.auto-style30 {
			font-family: Calibri;
			font-size: x-small;
		}

		.auto-style31 {
			font-family: Calibri;
			font-size: 11pt;
		}
	</style>
</head>

<body>

	<table cellspacing="0" class="auto-style1" style="width: 100%">
		<tr>
			<td class="auto-style3" rowspan="6"><span class="auto-style4"><strong>
						<img alt="" height="69" src={{ asset('/images/raylan-logo.svg') }} width="150" /><br />
						<br />
						<span class="auto-style15">SARL Raylan</span></strong></span><strong><br class="auto-style14" />
				</strong><span class="auto-style4"><strong><span class="auto-style15">Direction des système d'information</span><br class="auto-style15" />
						<br />
					</strong></span></td>
			<td class="auto-style3" rowspan="6">
				<h2 class="auto-style4">Objet</h2>
				<span class="auto-style14">Décharge de réception </span>
				<br class="auto-style14" />
				<span class="auto-style14">Matériel Informatique</span>
			</td>
			<td class="auto-style2"><strong>Classe de sécurité</strong></td>
			<td class="auto-style2">Usage Interne uniquement</td>
		</tr>
		<tr>
			<td class="auto-style2"><strong>Ref</strong></td>
			<td class="auto-style2">RAY-IT-TP-07032016</td>
		</tr>
		<tr>
			<td class="auto-style2"><strong>Date</strong></td>
			<td class="auto-style2">07/03/2016</td>
		</tr>
		<tr>
			<td class="auto-style2"><strong>Auteur</strong></td>
			<td class="auto-style2">Houadef</td>
		</tr>
		<tr>
			<td class="auto-style2"><strong>Périmètre</strong></td>
			<td class="auto-style2">Raylan</td>
		</tr>
		<tr>
			<td class="auto-style2"><strong>Approbation</strong></td>
			<td class="auto-style2">IT</td>
		</tr>
	</table>
	<p>&nbsp;</p>
	<h1 align="center"><span class="auto-style4" lang="FR">Restitution de
			PATRIMOINE Informatique № : {{$rest_code}}</o:p></span></h1>
	<p>&nbsp;</p>
	<p class="auto-style5" style="width: 1236px">
		<span class="auto-style24" lang="FR" style="mso-fareast-font-family: &quot;Times New Roman&quot;; background: yellow; mso-highlight: yellow; mso-ansi-language: FR; mso-fareast-language: FR; mso-bidi-language: AR-SA">
			Restitution</span><span class="auto-style6" lang="FR" style="background-position: 0% 0%; mso-fareast-font-family: &quot;Times New Roman&quot;; mso-highlight: yellow; mso-ansi-language: FR; mso-fareast-language: FR; mso-bidi-language: AR-SA; background-image: none; background-repeat: repeat; background-attachment: scroll;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date&nbsp;&nbsp;&nbsp; <script>
				document.write(new Date().toLocaleDateString());
			</script></span></p>
			<div align="right" class="auto-style33" id="imei" style="display: none;">
<br />
	<span class="auto-style24">IMEI1&nbsp;: {{$imei1}}<br />
	</span><o:p><span class="auto-style24" >IMEI2&nbsp;: {{$imei2}}</span></o:p></div>
</p>
	<span style="mso-bidi-font-weight:
normal">
		<table style="width: 100%; height: 155px">
			<tr>
				<td style="width: 470px">
					<p class="auto-style5" style="width: 530px"><span lang="FR">
							<span class="auto-style24">Je
								soussigné (e) </span><b style="mso-bidi-font-weight:normal">
								<span class="auto-style24" style="mso-spacerun:yes">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="auto-style24">Sehili Karim<br />
								</span></b>
							<span class="auto-style24">Fonction :</span><b style="mso-bidi-font-weight:normal"><span class="auto-style24">
									Responsable système information<br />
								</span></b>
							<span style="mso-bidi-font-weight:
normal">
								<span class="auto-style24" lang="FR" style="mso-fareast-font-family: &quot;Times New Roman&quot;; mso-ansi-language: FR; mso-fareast-language: FR; mso-bidi-language: AR-SA">
									Division/Dept : <strong>Informatique</strong></span></span></span></p>
				</td>
				<td><span style="mso-bidi-font-weight:
normal">
						<p class="auto-style5" style="width: 461px"><span class="auto-style24"><span lang="FR">
									Matricule&nbsp;:<br />
									<span style="mso-bidi-font-weight:normal">S</span>ervice
									:<br />

									<span style="mso-bidi-font-weight:
normal">
										<span class="auto-style24" lang="FR" style="mso-fareast-font-family: &quot;Times New Roman&quot;; mso-ansi-language: FR; mso-fareast-language: FR; mso-bidi-language: AR-SA">
											Direction&nbsp;:</span></o:p>
										</o:p><strong>Direction général</strong></span></span></span></p>
					</span></td>
			</tr>
		</table>
	</span>
	<table style="width: 100%">
		<tr>
			<td style="width: 542px">
				<p class="auto-style5" style="width: 530px"><span lang="FR">
						<span class="auto-style24">Reconnais avoir reçu de Mr : <strong>{{$nom}}
							</strong></span></span></span></p>
			</td>
			<td><span style="mso-bidi-font-weight:
normal">
					<p class="auto-style5" style="width: 461px"><span class="auto-style24"><span lang="FR">
								Fonction : {{$fonction}}
							</span></p>
				</span> </td>
		</tr>
	</table>
	</br>
	</br>
	<span class="auto-style22">
		<div align="center">
			<table id="aff_table" border="1" cellpadding="0" cellspacing="0" class="auto-style7" style="mso-table-layout-alt: fixed; mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 3.5pt 0cm 3.5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext">
				<tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes">
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">№ Item</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">Type</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">Marque</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">Modèle</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">№ Série / N-Tel</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">№ registre inventaire</span></th>
					<th class="auto-style26" style="border: solid windowtext 2.25pt; padding: 0cm 3.5pt 0cm 3.5pt">
						<span lang="FR">Observations</span></th>
				</tr>
				@foreach($mat_res as $item)
				<tr style="mso-yfti-irow:1;height:41.6pt;mso-height-rule:exactly">
					<td class="auto-style29 count" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR"></span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">{{$item->type_designation}}</span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">{{$item->mat_designation}}</span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">{{$item->mat_description}}</span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">{{$item->mat_ns}}</span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">/</span>
					</td>
					<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">
						<span lang="FR">{{$item->note}}</span>
					</td>
				</tr>
				@endforeach
			</table>
		</div>
		</br>
		</br>
		<div align="center">
			<table border="1" cellpadding="0" cellspacing="0" class="auto-style7" style="mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 3.5pt 0cm 3.5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext">
				<tr style="mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
					<td style="width: 562pt; border: solid windowtext 1.0pt; mso-border-alt: solid windowtext .5pt; padding: 0cm 3.5pt 0cm 3.5pt; height: 74px;" valign="top">
						<p class="auto-style10"><u><span lang="FR">Remarque&nbsp;: </o:p>
								</span></u></p>
						<p class="auto-style32"><span lang="FR">{{$remarque}}</o:p></span></p>
					</td>
				</tr>
			</table>
		</div>
		<p class="auto-style10">&nbsp;</p>
		<p class="auto-style10">&nbsp;</p>
		<div align="center">
			<table border="1" cellpadding="0" cellspacing="0" class="auto-style7" style="mso-border-alt: solid windowtext .5pt; mso-padding-alt: 0cm 3.5pt 0cm 3.5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext">
				<tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes">
					<td class="auto-style12" style="width:255pt; border:solid windowtext 1.0pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 3.5pt 0cm 3.5pt" valign="top">
						<span lang="FR" class="auto-style25">Date, nom et visa utilisateur</o:p></span></td>
					<td class="auto-style11" style="border-right: 1.0pt solid windowtext; border-top: 1.0pt solid windowtext; border-bottom: 1.0pt solid windowtext; width:300pt; mso-border-left-alt:solid windowtext .5pt; mso-border-alt:
  solid windowtext .5pt; padding:0cm 3.5pt 0cm 3.5pt; border-left-style: none; border-left-color: inherit; border-left-width: medium;" valign="top">
						<span class="auto-style26" lang="FR">Date et
							visa technique IT</o:p></span></td>
				</tr>
				<tr style="mso-yfti-irow:1;mso-yfti-lastrow:yes;">
					<td class="auto-style17" style="border-left: 1.0pt solid windowtext; border-right: 1.0pt solid windowtext; border-bottom: 1.0pt solid windowtext; width:255pt; mso-border-top-alt:solid windowtext .5pt; mso-border-alt:solid windowtext .5pt;
  padding:0cm 3.5pt 0cm 3.5pt; height:160pt; border-top-style: none; border-top-color: inherit; border-top-width: medium;" valign="top">
					</td>
					<td class="auto-style11" style="width:300pt; border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;
  mso-border-top-alt:solid windowtext .5pt;mso-border-left-alt:solid windowtext .5pt;
  mso-border-alt:solid windowtext .5pt;padding:0cm 3.5pt 0cm 3.5pt;height:160pt; border-left-style: none; border-left-color: inherit; border-left-width: medium; border-top-style: none; border-top-color: inherit; border-top-width: medium;" valign="top">
						<p class="auto-style24">
							</o:p>
						</p>
						<p class="auto-style24">
							<script>
								document.write(new Date().toLocaleDateString());
							</script><br>
							Sehili Karim</o:p>
						</p>
					</td>
				</tr>
			</table>
		</div>
		<!p class="auto-style4">&nbsp;</p>
	</span><span class="auto-style30">
		<footer class="auto-style11">
			<div class="auto-style11">
	</span>
	<span lang="FR" style="font-family:&quot;Arial&quot;,sans-serif;mso-ascii-theme-font:
minor-bidi;mso-hansi-theme-font:minor-bidi;mso-bidi-theme-font:minor-bidi" class="auto-style19">
		<span class="auto-style31">
			FABRICATION ET MONTAGE DE PRODUITS ELECTRIQUES, ELECTRONIQUES ET ELECTROMENAGERS<span style="mso-spacerun:yes">
			</span><span style="letter-spacing:.9pt"><br />
				S.A.R.L. AU CAPITAL DE 86 691 000.00 DA – RC N° 0363851B04<span style="mso-spacerun:yes">&nbsp;
				</span>-<span style="mso-spacerun:yes">&nbsp; </span>MF N° 000423036385170 <br />
			</span>Zone industrielle M.I.N. LOT N° 105, ELBOUNI. ANNABA - TEL. 038.80.24.81<span style="mso-spacerun:yes">&nbsp;&nbsp;
			</span>FAX 038. 86.15.79</o:p></span><span class="auto-style22"></div>
			</footer>
			<style type="text/css">
				#aff_table {
					counter-reset: section;
				}

				.count:before {
					counter-increment: section;
					content: counter(section);
				}

				.auto-style32 {
					font-size: 16pt;
					font-family: Calibri;
					text-align: left;
					margin-left: 0cm;
					margin-right: 0cm;
					margin-top: 0cm;
					margin-bottom: 6.0pt;
				}
			</style>
			<script type="text/javascript">
				$(document).ready(function() {
					if({{$imei1}} != 0) {
						$("#imei").show();
					}
				});
			</script>
</body>

</html>
Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

I changed the name of the looping variable but the same error still happening!

Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

Sorry about that here is where data is submitted to the database in the first method :

public function createRest(Request $request)
    {
     ...
 for ($i = 0; $i < count(explode(',', $request->mat_for_rest)); $i++) {
            if(($request->mat_for_rest)[$i] != "") {
                $check_num = Restitution::where('mat_code', explode(',', $request->mat_for_rest)[$i])->where('personnel_id', $personnel->id)->first();
                //Restitution::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id, 'num' => $num, 'mois' => date('m'), 'restitution_code' => $num . "/" . date('m') . "/" . date("Y"), 'note' => $request->note, 'user_id' => $request->user_id]);
                //Materiel::where('mat_code', '=', explode(',', $request->mat_for_rest)[$i])->update(array('mat_etat' => 2));
                //Journal_etat_materiel::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'date' => date('Y-m-d H:i:s')], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'note' => $request->note]);
                $mat_res[$i] = DB::table('Materiels')->join('Types', 'Materiels.type_id', '=', 'Types.type_id')->select('Types.type_designation', 'Materiels.mat_designation', 'Materiels.mat_description', 'Materiels.mat_ns', 'Materiels.note')->where('mat_code', explode(',', $request->mat_for_rest)[$i])->first();
            }
        }
...

The dd id in restImpr like this :

public function restImpr(Request $request)
    {
     ...
        $mat_res    =  session()->get('mat_res');
        dd($mat_res);
     ...
    }
Aug
12
2 months ago
Activity icon

Replied to Session()->flash Invalid Argument Supplied For Foreach() ?

@snapey I am doing the database query in the first method which redirect to a second method that returns a view because I need to prevent data from resubmitting in the database when the client refreshes the view, this way it will only call the second method, also when in restImpr :

dd($mat_res);

array:1 [▼
  0 => {#239 ▼
    +"type_designation": "Câble d'alimentation"
    +"mat_designation": "DIAMOND"
    +"mat_description": "LD-96W"
    +"mat_ns": "LD-AC96W"
    +"note": "Nouveau matériel"
  }
]

it seems it's not the type of array I need to use with foreach, how to solve this ?

Activity icon

Started a new Conversation Session()->flash Invalid Argument Supplied For Foreach() ?

I keep getting this error when session()->flash an array type of data like this :

Controller :

public function createRest(Request $request)
    {
	...
	 for ($i = 0; $i < count(explode(',', $request->mat_for_rest)); $i++) {
            if(($request->mat_for_rest)[$i] != "") {               
                $mat_res[$i] = DB::table('Materiels')->join('Types', 'Materiels.type_id', '=', 'Types.type_id')->select('Types.type_designation', 'Materiels.mat_designation', 'Materiels.mat_description', 'Materiels.mat_ns', 'Materiels.note')->where('mat_code', explode(',', $request->mat_for_rest)[$i])->first();
            }
	session()->flash('nom', $nom);
        session()->flash('imei1', $imei1);
        session()->flash('imei2', $imei2);
        session()->flash('fonction', $fonction);
        session()->flash('remarque', $remarque);
        session()->flash('mat_res', $mat_res);
	return redirect()->route('Restituter.restImpr');
}

 public function restImpr(Request $request)
    {
        $nom        =  session()->get('nom');
        $imei1      =  session()->get('imei1');
        $imei2      =  session()->get('imei2');        
        $fonction   =  session()->get('fonction');
        $remarque   =  session()->get('remarque');
        $rest_code  =  session()->get('rest_code');
        $mat_res    =  session()->get('mat_res');
        //dd($mat_res);
        return view('Restitution', compact('nom', 'fonction', 'imei1', 'imei2', 'remarque', 'rest_code'), ['mat_res' => $mat_res]);
    }

View :

@foreach($mat_res as $mat_res)
	<td>{{$mat_res->type_designation}}</td>
	...
@endforeach

route :

Route::post('Restituter/createRest', '[email protected]')->name('Restituter.createRest');
Route::get('Restituter/restImpr', '[email protected]')->name('Restituter.restImpr');

error :

ErrorException {#252 ▼
  #message: "Invalid argument supplied for foreach()"
  #code: 0
  #file: "C:\Users\...\Documents\Gestion SI\Gestion_SI - backup\storage\framework\viewsa34a4a0cbc39e06cbe12ff2445e1b3df1bd1833.php"
  #line: 266
  #severity: E_WARNING
}
//red line error ErrorException  tab
 <?php $__currentLoopData = $mat_res; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $mat_res): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
Aug
06
2 months ago
Activity icon

Replied to Laravel Prevent Form Resubmission On Page Refresh

Thanks for your reply, I will not be able to do it this way because not all the data is stored in the database, please look at my full function code:

public function createRest(Request $request)
    {
        $personnel = DB::table('Personnels')->where('Personnels.nom_prenom', $request->personnel)->first();
        $fonction = DB::table('Fonctions')->where('Fonctions.fonction_id', $personnel->fonction_id)->first();
        $structure = DB::table('Structures')->where('Structures.structure_id', $personnel->structure_id)->first();
        $rest = DB::table('Restitutions')->orderBy('created_at', 'desc')->where('Restitutions.mois', date('m'))->first();
        if (empty($rest)) {   
            $num = 1;
        }
        else {
            $num = $rest->num + 1;
        }
        $mat_res = array();
        for ($i = 0; $i < count(explode(',', $request->mat_for_rest)); $i++) {
            if(($request->mat_for_rest)[$i] != "") {
                $check_num = Restitution::where('mat_code', explode(',', $request->mat_for_rest)[$i])->where('personnel_id', $personnel->id)->first();
                Restitution::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'personnel_id' => $personnel->id, 'num' => $num, 'mois' => date('m'), 'restitution_code' => $num . "/" . date('m') . "/" . date("Y"), 'note' => $request->note, 'user_id' => $request->user_id]);
                Materiel::where('mat_code', '=', explode(',', $request->mat_for_rest)[$i])->update(array('mat_etat' => 2));
                Journal_etat_materiel::firstOrCreate(['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'date' => date('Y-m-d H:i:s')], ['mat_code' => explode(',', $request->mat_for_rest)[$i], 'etat_actuel' => 'Non affecté', 'note' => $request->note]);
                
$mat_res[$i] = DB::table('Materiels')->join('Types', 'Materiels.type_id', '=', 'Types.type_id')->select('Types.type_designation', 'Materiels.mat_designation', 'Materiels.mat_description', 'Materiels.mat_ns', 'Materiels.note')->where('mat_code', explode(',', $request->mat_for_rest)[$i])->first();                
            }
        }
        $nom = $request->personnel;
        //$service    = $request->service;
        $imei1      = $request->imei1;
        $imei2      = $request->imei2;        
        $fonction   = $fonction->fonction_designation . ' ' . $structure->structure_designation;
        $remarque   = $request->remarque;        
        if(empty($check_num)) {
            $rest_code  = $num . "/" . date('m') . "/" . date("Y");
        }
        else {
            $rest_code  = $num-1 . "/" . date('m') . "/" . date("Y");
        }
        return view('Restitution', compact('nom', 'fonction', 'imei1', 'imei2', 'remarque', 'rest_code'), ['mat_res' => $mat_res]);  
    }

As you see I need the $request->mat_for_rest in order to get mat_res and display it in the second view which is only needed for printing purposes.

Activity icon

Replied to Laravel Prevent Form Resubmission On Page Refresh

Can you give me an example please ?

Activity icon

Replied to Laravel Prevent Form Resubmission On Page Refresh

I keep getting erros when trying to send data with redirect, can you please show me how to do that in the same context ?

Activity icon

Started a new Conversation Laravel Prevent Form Resubmission On Page Refresh

I am using ajax to submit data in MySQL tables and display it in another view, the problem is that when refreshing the second view (F5 / CTRL + R) it resubmits all the data, which creates unwanted dupes in MySQL tables, what is the best way to prevent this from happening ?

Here is my code :

View :

$('#aff_form').on('submit', function(event) {
                //event.preventDefault();
                var form_data = $(this).serialize();
                var material_code = $('#material_code').val();
                var personnel = $('#personnel').val();
                var fonction = $('#fonction').val();
                var service = $('#service').val();
                var user_id = $('#user_id').val();
                var remarque = $('#remarque').val();
                var note = $('#note').val();
                $.ajax({
                    url: "{{ route('Affectation.createAff') }}",
                    method: "POST",
                    data: {
                        material_code: material_code,
                        personnel: personnel,
                        fonction: fonction,
                        service: service,
                        remarque: remarque,
                        note: note,
                        user_id: user_id
                    },
                    success: function(data) {
...
}

Controller :

...
 return view('Mise_a_disposition', compact('nom', 'fonction', 'service', 'imei1', 'imei2', 'remarque', 'aff_code'), ['mat_aff' => $mat_aff]);
}
Jul
19
3 months ago
Activity icon

Started a new Conversation Laravel Eloquent Select Where Latest Equal To Value

Hello, I have two MySQL tables, the second table recorded the states of an attribute of the first table, I need to get all the records of the first table where the last state of the attribute is equal to value, how to do it with eloquent ?

here is my code that I need to add the condition to :

    //Materiels table1
    //Journal_etat_materiels table2

    function getMaterielForAff(Request $request)
    {
        $data = Materiel::join('Types', 'Materiels.type_id', '=', 'Types.type_id')
                ->join('Users', 'Materiels.user_id', '=', 'Users.id')
                ->join('Journal_etat_materiels', 'Materiels.mat_code', '=', 'Journal_etat_materiels.mat_code')
                ->select(
                    'Materiels.id',
                    'Materiels.mat_code',
                    'Materiels.mat_designation',
                    'Materiels.mat_ns',
                    'Materiels.imei1',
                    'Materiels.imei2',
                    'Types.type_designation',
                    'Materiels.mat_description',
                    'Materiels.mat_carac',
                    'Materiels.note',
                    'Users.username',
                    'Materiels.mat_date'
                )
                ->whereNotIn('Materiels.mat_code', explode(' ', $request->mat_codes));

        return DataTables::of($data)
            ->addColumn('check', function ($check) {
                return '<input type="checkbox" required="required" name="check" class="check" id="' . $check->id . ' value="' . $check->id . '">';
            })
            ->rawColumns(['check'])
            ->make(true);
    }
Jul
01
3 months ago
Activity icon

Started a new Conversation How To Access {{array}} In Laravel ?

I need to send an {{array}} via laravel controller then access this array attributes in the view like this :

Controller :

$mat_aff = array();

for ($i = 0; $i < count(explode(' ', $request->material_code)); $i++) {
                   ...
                    $mat_aff[] =  explode(' ', $request->material_code)[$i];
                }

return view('Mise_a_disposition', compact('mat_aff'));

View :

$(document).ready(function() {
					var table = $("#aff_table");
					var rowNum = {{$rowNum}};
					var resultHtml = '';				
					for (var i = 1; i < rowNum; i++) {
						resultHtml += ['<tr style="mso-yfti-irow:1;height:41.6pt;mso-height-rule:exactly">' +
					'<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">' +
						'<span lang="FR">'+ i +'</span>' +
					'</td>' +
					'<td class="auto-style29" style="border-left: solid windowtext 2.25pt; border-bottom: solid windowtext 1.0pt; border-right: solid windowtext 2.25pt; mso-border-top-alt: solid windowtext .5pt; mso-border-top-alt: .5pt; mso-border-left-alt: 2.25pt; mso-border-bottom-alt: .5pt; mso-border-right-alt: 2.25pt; mso-border-color-alt: windowtext; mso-border-style-alt: solid; padding: 0cm 3.5pt 0cm 3.5pt; height: 41.6pt; mso-height-rule: exactly; border-top-style: none; border-top-color: inherit; border-top-width: medium;">' +
						'<span lang="FR">'+ {{$mat_aff[i]}} +'</span>' +
					'</td>' + ...
Jun
07
4 months ago
Activity icon

Started a new Conversation What's The Best Pdf Package For Laravel ?

I am developing an application where I need to convert an html page with a template to a printable pdf file what's the best way to do that ?

Jun
02
4 months ago
Activity icon

Replied to Laravel Mysql Select All Except An Array Of Values ?

@rodrigo.pedra Hello thank you for your reply I have an issue trying to give whereNotIn parameter like this :

$mat_codes = [];
        if($request->mat_codes == null) {
            array_push($mat_codes, "");
        }
        else {
            array_push($mat_codes, $request->mat_codes);
        }

 $data = Materiel::join('Types', 'Materiels.type_id', '=', 'Types.type_id')->join('Users', 'Materiels.user_id', '=', 'Users.id')
            ->select('Materiels.id', 'Materiels.mat_code', 'Materiels.mat_designation', 'Materiels.mat_ns', 'Types.type_designation', 'Materiels.mat_description', 'Materiels.note', 'Users.username', 'Materiels.mat_date')->whereNotIn('Materiels.mat_code', $mat_codes);

But It keeps not working If I do :

dd($mat_codes);

array:1 [
  0 => "xxx,123"
]

Please help!

Jun
01
4 months ago
Activity icon

Started a new Conversation Laravel DataTables Load Data Except Certain Rows

Hello, I need to load a datatable each time except certain rows, I keep getting all the rows even when console.log and dd are giving the correct parameteres, here is my code :

Controller :

function getMaterielForAff(Request $request)
    {
        $mat_codes = [];
        if($request->mat_codes == null) {
            array_push($mat_codes, "");
        }
        else {
            array_push($mat_codes, $request->mat_codes);
        }
        //dd($mat_codes);
        $data = Materiel::join('Types', 'Materiels.type_id', '=', 'Types.type_id')->join('Users', 'Materiels.user_id', '=', 'Users.id')
            ->select('Materiels.id', 'Materiels.mat_code', 'Materiels.mat_designation', 'Materiels.mat_ns', 'Types.type_designation', 'Materiels.mat_description', 'Materiels.note', 'Users.username', 'Materiels.mat_date')->whereNotIn('Materiels.mat_code', $mat_codes);
        return DataTables::of($data)
            ->addColumn('modifier', function ($data) {
                return '<a href="#" class="Modifier" id="' . $data->id . '"><i class="material-icons">edit</i></a>';
            })
            ->addColumn('supprimer', function ($sup) {
                return '<a href="#" class="Supprimer" id="' . $sup->id . '"><i class="material-icons">delete</i></a>';
            })
            ->addColumn('check', function ($check) {
                return '<input type="checkbox" required="required" name="check" class="check" id="' . $check->id . ' value="' . $check->id . '">';
            })
            ->rawColumns(['modifier', 'supprimer', 'check'])
            ->make(true);
    }

View :

$("#cherche_mat").on("click", function() {
                $("#nb_mat").val(counter);
                var mat_codes = [];
                if (counter != 1) {
                    for (var i = 1; i < counter; i++) {
                        if (mat_codes.indexOf($('#mat_code_' + (i - 1) + '').val()) === -1) {
                            mat_codes.push($('#mat_code_' + (i - 1) + '').val());
                        }
                    }
                }
                //console.log(mat_codes);
                $('#m_table').DataTable().ajax.url(
                    "/Affectation/getMaterielForAff?mat_codes=" + mat_codes + "").load();
            });

When :

console.log(mat_codes);

["xxx", "123"]

When :

dd($mat_codes);

array:1 [
  0 => "xxx,123"
]

When doing :

->whereNotIn('Materiels.mat_code', ["xxx", "123"]); it works