iGenezys

iGenezys

Member Since 2 Years Ago

Experience Points 2,470
Experience Level 1

2,530 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 1
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

18 Sep
10 months ago

iGenezys left a reply on Multiple Pagination

Ok ! Thank You !

iGenezys left a reply on Multiple Pagination

It's perfect, thank you !

Just asking @Snapey , how could I put this in the controller ? Like this ?


$devs->appends(['template' => request('template', 1)]);
$templates->appends(['dev' => request('dev', 1)]);

then keep de $devs->links()in the view ?

Feels like it's working, but I prefer asking and be sure !

Thank you anyway !

iGenezys started a new conversation Multiple Pagination

Hi people.

I saw the subject a lot of times but it didn"t satisfied me, so I'm asking here.

I need to do a multiple pagination on a page. In this page I have two lists and need to have my pagination on each lists.

Actually I did this in the controller :


public function getDev(){
        $devs = Developpement::where('id_categorie', 1)->paginate(1, ['*'], 'dev');
        $templates = Developpement::where('id_categorie', 2)->paginate(1, ['*'], 'template');

        return view('main.developpement', compact('devs', 'templates'));
    }

And my view just have the {{ $templates->links() }} and {{ $devs->links() }}

Actually the result is that I when I click on my first pagination, everything is correct and the second is fine too. But when I click on the second, It reset the first. The URL stay like :

http://localhost:8888/tloading/developpement?template=2

I'd like to have an URL like http://localhost:8888/tloading/developpement?template=2&devs=2

How could I do this ?

Thank You !

30 Jan
1 year ago

iGenezys left a reply on Google Map - Display A Toast When Click

Hi, thank you for your both responses.

It helped a lot ! :)

26 Jan
1 year ago

iGenezys started a new conversation Google Map - Display A Toast When Click

Hi people.

I had a question, for a mini website I made for try google map. In this website I display a few markers, and I want that when I click on one of them, a toast pop and show the information of the user. I tried to to like this :

var map;
 
        function initMap() {
            map = new google.maps.Map(document.getElementById('map'), {
                center: {lat: 48.764651, lng: 0.628715},
                zoom: 8
            });
        }
 
        function addMarker(location, adresse, client) {
            marker = new google.maps.Marker({
                position: location,
                map: map,
                title: adresse,
                click: function(e){
                    Materialize.toast('Client ' + client + ', adresse ' + adresse, 2600, 'rounded');
                }
            });
        }
         
        $.ajax({
            url: "/parcagraire/getCommercial/",
            type: "GET",
            dataType: "json",
            success: function( response ){
                $.ajax({
                    url: "/parcagraire/commercial/"+response,
                    type: "GET",
                    dataType: "json",
                    success: function( ret ){
                        $.each( ret, function( index, value ){
                            city = new google.maps.LatLng(value.latitude, value.longitude);
                            adresse = value.adresse;
                            client = value.client;
                            addMarker(CentralPark, adresse, client);
                        });
                    }
                });
            }
        });

Inside the addMarker, but when I click it do nothing. When I remove the toast code from de "function", it pop all the toasts for every users once, and not work after.

Do you have an idea ? Thank you !

14 Jan
1 year ago

iGenezys left a reply on Google Map - Not Loading When Refresh Page

I think that worked, thank you !

iGenezys started a new conversation Google Map - Not Loading When Refresh Page

Hi people.

I wanted to try to google map API in an application that :

  • Create an User (Email, adress, city, postal code),
  • Define the latitude & longitude from the adress,
  • Put a mark on google map with this adress.

Actually, it's working well, you can even try on my site : mapuser.leroy-thomas.fr

But I found a problem.

Sometimes, when you reload the page, the map don't want to appear, and in the console, I got an error :

Uncaught 
Qb {message: "initMap is not a function", name: "InvalidValueError", stack: "Error↵    at new Qb (https://maps.googleapis.com/m…KHdBCcpmkMnyrgIbpupNBQL5c&callback=initMap:150:59"}
message:"initMap is not a function"
name:"InvalidValueError"

I don't know why it's doing that, because it's a bit random, sometimes I can reload the page 10 times without any erros, and after the page don't want to reload.

If you want my JS code :

<script type="text/javascript">
        var map;

        function initMap() {
            map = new google.maps.Map(document.getElementById('map'), {
                center: {lat: 48.764651, lng: 0.628715},
                zoom: 8
            });
        }

        function addMarker(location) {
            marker = new google.maps.Marker({
                position: location,
                map: map
            });
        }

        function marker(){
            CentralPark = new google.maps.LatLng(48.764651, 0.628715);
            addMarker(CentralPark);
        }

        $.ajax({
            url: "/mapuser/getUser",
            type: "GET",
            dataType: "json",
            success: function( response ){

                $.each( response, function( index, value ){
                    City = new google.maps.LatLng(value.latitude, value.longitude);
                    addMarker(City);
                });
            }
        });
    </script>

Well, you can try on the website, and if you have an idea about why it's doing that, and what to do for solve this problem, I thank you in advance.

01 Jan
1 year ago

iGenezys left a reply on Multiple SQL Request - Modal Window

Hi, thank you for your response, it helps a lot.

Last thing. You saw in the screen that I had two same SQL request, the first was the function in my model, but the second come to my belongsTo relation :

    public function getDimension_av(){
        return $this->belongsTo('App\Dimension', 'dimensions_av');
    }

    public function getDimension_ar(){
        return $this->belongsTo('App\Dimension', 'dimensions_ar');
    }

Going to this :

    public function largeur(){
        return $this->belongsTo('App\Largeur', 'id_largeur');
    }


    public function hauteur(){
        return $this->belongsTo('App\Hauteur', 'id_hauteur');
    }


    public function diametre(){
        return $this->belongsTo('App\Diametre', 'id_diametre');
    }

That I call here :

<td class="col m2 center-align">
                                {{ $tra->getDimension_av->largeur->largeur }}/{{ $tra->getDimension_av->hauteur->hauteur }}-{{ $tra->getDimension_av->diametre->diametre }}
                            </td>

Is there a way to handle this with an In ?

31 Dec
1 year ago

iGenezys left a reply on Multiple SQL Request - Modal Window

I tried to use relationship

public function getCompleteDim($dimension)
    {
        $id_dim = Dimension::with(['largeur', 'hauteur', 'diametre'])->find($dimension);

        $id_largeur = $id_dim->largeur->largeur;
        $id_hauteur = $id_dim->hauteur->hauteur;
        $id_diametre = $id_dim->diametre->diametre;

        $dim = "$id_largeur/$id_hauteur-$id_diametre";

        return $dim;
    }

I got some less requests but still too much.

For my debugbar it's doing the same request twice, and even without the in.

If you want a screen : http://hpics.li/c17c225

Aniway, I don't know what is "Catching" ?

Just asking, is there a way to stop the sql request if the modal is closed ? And trigger them when I open it ?

iGenezys started a new conversation Multiple SQL Request - Modal Window

Hi people.

I have a question. In a website, I'm using modal windows for pages like add or update something.

In my update, I need to take a specific value in a specific format for suit with an autocomplete.

So for this, I did this code in my model :

public function getCompleteDim($dimension)
    {
        $id_dim = Dimension::where('id', $dimension)->first();

        $id_largeur = $id_dim->id_largeur;
        $id_hauteur = $id_dim->id_hauteur;
        $id_diametre = $id_dim->id_diametre;

        $largeur = Largeur::where('id', $id_largeur)->first();
        $hauteur = Hauteur::where('id', $id_hauteur)->first();
        $diametre = Diametre::where('id', $id_diametre)->first();

        $dim = "$largeur->largeur/$hauteur->hauteur-$diametre->diametre";

        return $dim;
    }

It's returning me exactly what I want, but I have an other problem. Actually, this code is doing 4 SQL requests, each time I call it. If I have 15 edit modal, It will do ~60 SQL requests.

In my modal I call it like this :

        <div class="col m6 input-field">
            {!! Form::label('dim_av', 'Dimension Avant') !!}
            {!! Form::text('dim_av', $tra->getCompleteDim($remo->dimension), ['class' => 'form-control autocomplete', 'id' => 'dim_av']) !!}
        </div>

So I'd like to limit the number of my SQL requests to the minimal, and I don't know if there is a way to do this by changing my function, or something that stop the SQL request if the modal window is close.

Well, if you have some advice, I thank you !

25 Dec
1 year ago
24 Dec
1 year ago

iGenezys started a new conversation Ajax - Materialize Autocomplete Image

Hi people.

I tried to use autocomplete from materialize, and I had two erros, my datas are perfectly loading, but when they are displaying, I have an image in the right of the text, and an error in the console, a 404 error.

If you want an image of the bugs, here it is :

The img in the text : http://hpics.li/a93c41e The consoles error : http://hpics.li/917b92c

My JS code is like this :

$(function() {
            $.ajax({
                url: "/parcagraire/getdata",
                type: "GET",
                dataType: "json",

                success: function( response ){
                    var dimensions = response;
                    var dataDim = {};
                    for (var i = 0; i < dimensions.length; i++) {
                        dataDim[dimensions[i].value] = dimensions[i].id; //countryArray[i].flag or null
                    }

                    console.log(dataDim);

                    $('.autocomplete').autocomplete({
                        data: dataDim,
                        minLength: 2,
                    });
                }
            });
        });

Is there a solution for stopping have these errors ? Maybe an option I didn't put in my jQuery code ?

21 Dec
1 year ago

iGenezys left a reply on Materialize Toast After A Login

Perfect, thank you !

20 Dec
1 year ago

iGenezys started a new conversation Materialize Toast After A Login

Hi people.

I need some help, I wanted to try Materialize, and I wanted to show a toast when my user is correctly logging.

But actually, I'm doing it wrong because it's stopping the page and the script is loading right before all my file calls, making an error.

I'm doing my code in the authenticated method in AuthenticatesUsers :

protected function authenticated(Request $request, $user)
    {
        return "
        <script type='text/javascript'>
            $(document).ready(function() {
                Materialize.toast('Now logged !', 2200, 'rounded');
            });  
        </script>');
        ";
    }

I tried to do it with "echo" but not working too.

Do you have an idea ?

13 Dec
1 year ago

iGenezys started a new conversation Adfly ? How Does It Work ?

Hi people ! I have a question, I'm sorry if I'm in the wrong forum, but I didn't know where to go.

Well, just a simple question. I did an application, and in this app people can click on some links that can go on Adfly, when they valid it, they win points or something.

But I never used Adfly for this before, so my question is "what can I do for use adfly correctly for my website ?"

  • I need to shortcut a link on adfly, that link return on my controller that give points to user ?
  • Is there an other way ?

Still sorry if i'm in the wrong forum, and thank you if you can help me :)

02 Dec
1 year ago
30 Nov
1 year ago

iGenezys left a reply on JQuery - Ajax - Lottery Winner

Hi !

Sorry, long time without any computer or code :(

Well, I tried your response, and I have one problem : I don't have an unique winner.

Here's the code :

Route::name('get_user')->get('get_user', function() {
    $lien = User_liens::where('chance', true)->inRandomOrder()->first();
    
    $user = \App\User::where('id', $lien->user_id)->first();
    $date = date('Y-m-d H:m:s');

    if ($user->lottery_submit < \Carbon\Carbon::today()->subDays(1)){

        $solde_pts = $user->solde_points + 20;

        $user->update([
            'solde_points' => $solde_pts,
            'lottery_submit' => $date
        ]);

        return \Response::json($user);
    }
    else{
        $user = 'nope';
        return \Response::json($user);
    }

});

It's actually working, but if I have 3 potential winners, the code is going to find the first winner, credit his points, and add the date, and he'll not have another credit during >24h; But, if I reload the page, the script is going to search about the 2 others users, and do the same thing, until there is no users left.

Do you have an idea for getting only one winner ?

10 Nov
1 year ago
07 Nov
1 year ago

iGenezys started a new conversation JQuery - Ajax - Lottery Winner

Hi people.

I'd like to do a lottery system, with a countdown and a winner that win points. I did all the countdown and correctly did the ajax requests for picking up a winner and put his points in the database :

jQuery(function ($) {
    var launch = new Date(2017, 10, 06, 23, 41, 40);
    var days = $('#jours');
    var hours = $('#heures');
    var minuts = $('#minutes');
    var seconds = $('#secondes');

    function setDate(){
        var now = new Date();
        var time = launch.getTime() - now.getTime();
        var s = (launch.getTime() - now.getTime()) / 1000;
        var d = Math.floor(s / 86400);
        var timer = setTimeout(setDate, 1000);
        
        days.html('<strong class="min">'+ d +'</strong><p class="arvo">Jour'+(d>1?'s':'')+'</p>')
        s -= d * 86400;

        var h = Math.floor(s / 3600);
        hours.html('<strong class="min">'+ h +'</strong><p class="arvo">Heure'+(h>1?'s':'')+'</p>')
        s -= h * 3600;

        var m = Math.floor(s / 60);
        minuts.html('<strong class="min">'+ m +'</strong><p class="arvo">Minute'+(m>1?'s':'')+'</p>')
        s -= m * 60;

        s = Math.floor(s);
        seconds.html('<strong class="min">'+ s +'</strong><p class="arvo">Seconde'+(s>1?'s':'')+'</p>');

        if(Math.ceil(time) <= 1000)
        {
            $.ajax({
                url: "/triumphclick/get_user",
                type: "GET",
                dataType: "json",
                success: function ( data ) {
                    var user = data;

                    $('.gagnant').html('<strong class="win">Le gagnant est '+ user.login +'!</strong>' +
                        '<p><h6 class="org"><i><b>Votre compte a été crédité ! Félicitation !</b></i></h6></p>')

                }
            });
            
            clearTimeout(timer);
            $('.bloc-min').addClass('removed');
        }

    }
    setDate();


});

I'm getting the user with this laravel route :

Route::name('get_user')->get('get_user', function(){
    $lien = User_liens::where('chance', true)->inRandomOrder()->first();

    $user = \App\User::where('id', $lien->user_id)->first();
    $solde_pts = $user->solde_points + 20;

    $user->update([
        'solde_points' => $solde_pts,
    ]);

    return \Response::json($user);
});

But the problem is that when I reload the page, it do again the code and the winner get his points again and again.

And something else, I think that this way is not really secure, it's a js code so I guess people can go through, so I wanted to do this code :

if(Math.ceil(time) <= 1000)
        {
            $.ajax({
                url: "/triumphclick/get_user",
                type: "GET",
                dataType: "json",
                success: function ( data ) {
            return data;
                }
            });
        }

On the server side with PHP. But I never did that, and I don't know how to do all the checking and the code, from JS to PHP, I'm really lost here..

Well, I don't know if I was clear, but if you have some ideas that could help me, I thank you !

29 Oct
1 year ago

iGenezys left a reply on Image Gallery - Browse A Collection 1 By 1

JS or something like that ? Fine, but can I have the beginning of the runway ? Because actually I just don't know what to do for solve my problems.

iGenezys started a new conversation Image Gallery - Browse A Collection 1 By 1

Hi people.

I want to do an Image gallery on my laravel project. I want to get all my images randomly, and display them one by one, and have a button that can browse the collection.

I have the collection like this :

public function random(){
        $images = Images::all();
        $countImage = Images::count();

        $randoImages = $images->random($countImage);

        return view('main.random', compact('randoImages'));
    }

And I have this in the view :

<div class="col s12">
        @foreach ($randoImages as $img)
            <img class="responsive-img loutre z-depth-5" src="{{ URL::asset("images/$img->image") }}">
        @endforeach
    </div>
    <div class="col s12 btns">
        <div class="col s4">
            <a class="btn btn-main left z-depth-3"><span class="material-icons arr">keyboard_arrow_left</span></a>
        </div>
        <div class="col s4 center">
            <a class="btn btn-floating btn-coeur z-depth-5"><span class="material-icons fav">favorite</span></a>
        </div>
        <div class="col s4">
            <a class="btn btn-main right z-depth-3"><span class="material-icons arr">keyboard_arrow_right</span></a>
        </div>
    </div>

But actually my foreach is displaying all the images on the same page, and I don't know how to display them one by one.

And for the two buttons right/left, I want them to browse the collection, but I didn't find anything about this, seems that next()/previous() methods are not existing in laravel.

I don't want to use the pagination as much as possible, so if you have some ideas that could help me to fix these problems, I thank you in advance !

20 Oct
1 year ago

iGenezys started a new conversation Custom Validation & Multiple Form Validation

Hi guys.

I had two question for my laravel app. First, I need to create a customed validation for my form, with this kind of condition, I just don't know the syntax :

I have two inputs "team", and I want to put an error if the third input "team_win" is not equal to the value of one of the two previous inputs

if(isset($request->equipe_gagne))
        {
            if ($request->equipe_gagne != $request->equipe1 || $request->equipe_gagne != $request->equipe1) {
                return $this->create()->withErrors('L\'équipe que vous avez noté ne fais pas partie du match.');
            }
            $valeur_pari = "L'équipe $request->equipe_gagne remporte le match.";
        }

I took this code in internet but I think it's deprecated...

Second, I need to do a validation on a multiple form, this type of form :

<div class="col-md-6 form-inline{{ $errors->has('equipe1') ? ' has-error' : '' }}">
                            {!! Form::label('equipe1', 'Equipe à Domicile :') !!}
                            {!! Form::text('equipe1[]', null, ['class' => 'form-control equipe1']) !!}

                            @if ($errors->has('equipe1'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('equipe1') }}</strong>
                                </span>
                            @endif
                        </div>

I did the validation like this :

'equipe1[]' => "required"

But it's not working, I tried to do it without the [], but still not that.

If you have some ideas that could help me, I thank you in advance !

11 Oct
1 year ago

iGenezys left a reply on Button Copy A Form - Add Inputs Buttons

@ejdelmonico Actually I wanted to try it with vue, but I'm not really good in JS and I'm still training, I prefered do it in JS, but whel I'll be able to understand how to do this with Vue, i'll do it :)

@dev.kobus Nice, it works for me :) I have an another question. I have a select, and when i'm clicking on a option, an another input appears. I'm using this code for that :

"use strict";

var select = document.getElementById("paris");
var languages = Array.prototype.slice.call(document.getElementsByClassName("liste_paris"));

function hide(language) {
    language.classList.add("hide");
}

function displayLanguage(event) {
    var selected_language = event.target.value;
    languages.map(hide); 

    document.getElementById(selected_language).classList.remove("hide"); 
}

select.addEventListener("change", displayLanguage);

But when I'm cloning my form, this js code is not working on the others selects. I tried to do two select in my form (without cloning) :

<div class="col-md-6">
                                {!! Form::label('pari', 'Pari :') !!}
                                <select class="form-control" name="pari" id="paris">
                                    <option value="empty"></option>
                                    @foreach($pari as $pa => $p)
                                        <option value="{{ $pa }}">{{ $p }}</option>
                                    @endforeach
                                </select>
                            </div>
                            <div class="col-md-6">
                                {!! Form::label('pari', 'Pari :') !!}
                                <select class="form-control" name="pari" id="paris">
                                    <option value="empty"></option>
                                    @foreach($pari as $pa => $p)
                                        <option value="{{ $pa }}">{{ $p }}</option>
                                    @endforeach
                                </select>
                            </div>

Only the first is doing the JS code, not the second. Do you have an idea about what's wrong ?

05 Oct
1 year ago

iGenezys started a new conversation Button Copy A Form - Add Inputs Buttons

Hi guys. I'm here because I'm still a JS noob, and for a project, I need to have a button that can put a unlimited number of form or inputs in my form with a button.

I made a codepen of my form, it'll be more easy : https://codepen.io/Arckays/pen/NaXxKq?editors=1010

The part that I want to copy is this one :

<div class="col-md-12 main">
          <div class="col-md-12 equipes cnt">
            <div class="col-md-6 form-inline">
              <label for="equipe1">Equipe à Domicile : </label>
              <input type="text" class="form-control" name="equipe1" id="equipe1" form="form">
            </div>
            <div class="col-md-6 form-inline">
              <label for="equipe2">Equipe à l'Extérieur : </label>
              <input type="text" class="form-control" name="equipe2" id="equipe2" form="form">
            </div>
          </div>
          <div class="col-md-12 image form-inline cnt">
            <label for="image">Image : </label>
            <input type="file" class="form-control" name="image" id="image">
          </div>
          <div class="col-md-12 pari form-inline cnt">
            <div class="col-md-6">
              <label for="pari">Paris : </label>
              <select class="form-control" name="pari" id="pari" form="form">
                <option value="empty"></option>
              </select>
            </div>
            <div class="col-md-6 form-inline cnt">
              <div id="0" class="col-md-12 liste_paris hide cnt">
                <button type="button" class="close" aria-label="Close" onclick="removeDiv('equipe_gagne')"><span aria-hidden="true">&times;</span></button>
                <label for="equipe_gagne">Equipe : </label>
                <input type="text" name="equipe_gagne" id="equipe_gagne" class="form-control" form="form">
              </div>
              <div id="1" class="col-md-12 liste_paris hide cnt">
                <button type="button" class="close" aria-label="Close" onclick="removeDiv('joueur_marque')"><span aria-hidden="true">&times;</span></button>
                <label for="joueur_marque">Joueur : </label>
                <input type="text" name="joueur_marque" id="joueur_marque" class="form-control" form="form">
              </div>
              <div id="5" class="col-md-12 liste_paris hide cnt">
                <button type="button" class="close" aria-label="Close" onclick="removeDiv('equipe_marque_premier')"><span aria-hidden="true">&times;</span></button>
                <label for="equipe_marque_premier">Equipe : </label>
                <input type="text" name="equipe_marque_premier" id="equipe_marque_premier" class="form-control" form="form">
              </div>
              <div id="2" class="col-md-12 liste_paris hide cnt">
                <button type="button" class="close" aria-label="Close" onclick="removeDiv('nbBut')"><span aria-hidden="true">&times;</span></button>
                <label for="nbBut" >Nombre de buts : </label>
                <select class="form-control" name="nbBut1" id="nbBut1" form="form">
                  <option></option>
                </select>
              </div>
              <div id="3" class="col-md-12 liste_paris hide cnt">
                <button type="button" class="close" aria-label="Close" onclick="removeDiv('nbBut')"><span aria-hidden="true">&times;</span></button>
                <label for="nbBut" >Nombre de buts : </label>
                <select class="form-control" name="nbBut2" id="paris" form="form">
                  <option></option>
                </select>
              </div>
            </div>
          </div>  
        <div class="col-md-12 ajout-form cnt">
          <a href="#" onclick="addForm()">
            <i class="material-icons green-text">add_circle</i>
          </a>
        </div>

But I don't know what to do in JS for copy something that big. I saw some fiddle with vue but it's with a table and my form ins't.. And for other fiddles the form is too big and I don't know what to do in my OnClick for have something that big in copy.

If you have some ideas that could help me, I thank you in advance !

26 Sep
1 year ago

iGenezys left a reply on Mailer - Sens Email To Many Address

$aAgenceMail is an Array :

Array ( [0] => [email protected] [1] => [email protected] [2] => [email protected] )

iGenezys left a reply on Mailer - Sens Email To Many Address

I saw this page, it's not really helping :/ In facts, if I have only one mail address, it's working, but if I have more, I have the bug

iGenezys started a new conversation Mailer - Sens Email To Many Address

Hi people. I use Mailer for sending mail, sometimes I need to send the mail to many address, and here it's blocking.

For have my adresses, I did like this :

foreach ($panier_occasion as $com_p)
        {
            $aAgenceMail[] = $com_p->occasion->getAgence->email;
        }

        $listMail = implode(", ", array_unique($aAgenceMail));

It correctly returns me a string with one or many addresses. But, when I'm using it in Mailer :

$this->mailer->send(['text' => 'mail.commande_agence'], compact('commande'), function($message) use($commande, $listMail){
            $message->to($listMail)->from('[email protected]')->subject("Commande n°$commande->id");
        });

I have an error that I can't understand "Address in mailbox given [[email protected], [email protected]] does not comply with RFC 2822, 3.6.2."

Do you have an Idea about what I'm doing wrong ?

10 Sep
1 year ago

iGenezys left a reply on Duplication Problem

That's perfect ! Thank you :)

And for my view problem, is there a solution too or is this normal ?

08 Sep
1 year ago

iGenezys left a reply on Duplication Problem

Ok, my bad. I looked more in my debugbar, and I said that I only use my foreach's datas, but there is some datas that query the database.

Something like this :

<td class="cnt">
                            <p>{{$oc->getDimension->largeur->largeur}}//here
                                / {{$oc->getDimension->hauteur->hauteur}}//here
                                - {{$oc->getDimension->diametre->diametre}}//here</p>
                            <p class="bld">{{$oc->marque}}</p>
                        </td>

It's still in the foreach so it's finally the same problem, so is this normal, or if it's not, what can I do for solve this ?

07 Sep
1 year ago

iGenezys left a reply on Duplication Problem

Well, I thought it wasn't normal for my view, is there a different way or it is fine with this ?

Not in these includes, juste usings my foreach's datas, I don't think that the sql problem is linked with the views problem, fort me it's in my queries in my controller

iGenezys started a new conversation Duplication Problem

Hi guys. I'm here because I have two little problems on my code.

First, here's an image of my debugbar on a page what's displaying items :

http://hpics.li/7a5f24c

As you can see, I have 35 views on my page, and 25 queries, both are duplications, and I don't know how to fix this.

First, the queries :

In my code I have my post function :

public function postOccasion()
    {
        $largeur = Input::get('largeur');
        $hauteur = Input::get('hauteur');
        $diametre = Input::get('diametre');
        $id = Input::get('id_occasion');
        $dimension = Input::get('dimension');

        if(!empty($largeur) || !empty($hauteur) || !empty($diametre))
        {
            $dimLHD = Dimension::getLargeur($largeur)
                ->getHauteur($hauteur)
                ->getDiametre($diametre)
                ->get();

            //....
        }

        if(isset($dimension))
        {
            $dim1 = explode('-', $dimension);
            $dimDiametre = $dim1[1];
            $dim2 = explode('/', $dim1[0]);
            $dimLargeur = $dim2[0];
            $dimHauteur = $dim2[1];

            $idLargeur = Largeur::where('largeur', $dimLargeur)->select('id')->first();
            $idHauteur = Hauteur::where('hauteur', $dimHauteur)->select('id')->first();
            $idDiametre = Diametre::where('diametre', $dimDiametre)->select('id')->first();

            $dimension1 = Dimension::where('id_largeur', $idLargeur->id)
                ->where('id_hauteur', $idHauteur->id)
                ->where('id_diametre', $idDiametre->id)
                ->select('id')
                ->first();

            $idDimension = $dimension1->id;
        }
        else{
            $idDimension = 0;
        }

    //...

        $occas = Occasion::getDimensionLHD($finalId)
            ->vente($vendu)
            ->carcasse($carcasse)
            ->dimension($idDimension)
            ->idOccasion($id)
            ->get();

    //...
    }

Here's all the requests what are duplicated, and I don't know what to do to stop this duplication.

And second, the views :

In my view i'm using blade for shorten my code. I have some modal and i'm calling them like this :

@if(!empty($occasions))
    @foreach ($occasions as $oc)
    <tr>
        <td>
                        @if(Auth::check())
                            @include('recherche.occasion.infos')
                            @include('recherche.occasion.achat')
                            @include('recherche.occasion.edit')
                            @include('recherche.occasion.transfert')
                            @include('recherche.occasion.vente')
                            @include('recherche.occasion.contact')
            @endif 
        </td>
    </tr>
    @endforeach
@endif
                    

And it's duplicating, I don't know what to do here.

If you have some idea about what to do for solve these two problems, I thank you in advance ! :)

27 Aug
1 year ago

iGenezys left a reply on Delete Method Not Allowed

Hi, sorry I couldn't come back here before now.

So, actually I tried the two ways that you gave to me, the @saurabhd 's way is working, and @Clickagee 's way make me the same error, maybe it's my route the problem ?

I heard @Snapey 's advice, so, do you still have an idea why this way is not working for me ?

25 Aug
1 year ago

iGenezys started a new conversation Delete Method Not Allowed

Hi people.

I want to use delete from a button for... Deleting a plug. I created the route :

Route::name('recherche.occasion.destroy')->delete('recherche/occasion/{occasion}', '[email protected]');

And in my view, I have this :

<a class="glyphicon glyphicon-remove" href="{{ action('[email protected]', $oc) }}" data-method="delete"></a>

But when I click, I got an error MethodNotAllowedException. In the URL everything is fine, so I don't really know what's causing trouble here.

If you have an idea about what I did wrong, thank you in advance !

11 Aug
1 year ago

iGenezys left a reply on Have A Get URL With A Post Form Informations

Hi, my routes are like this :

Route::name('recherche.postOccasion')->post('recherche/occasion/search', '[email protected]');
Route::name('recherche.getOccasion')->get('recherche/occasion/search', '[email protected]');

I did like you said, but I got an error

Missing argument 1 for App\Http\Controllers\RechercheController::search()

I don't want any variables in the search's URL

10 Aug
1 year ago

iGenezys started a new conversation Have A Get URL With A Post Form Informations

Hi guys, sorry if I didn't explained myself very well in the title, I didn't know how to be clear, i'll be here :

I'm posting a form with some informations, and I want to have a different URL to significate that there is a research here.

In my controller, I did the code like that :

public function postOccasion()
    {

        $occasions = Occasion::getDimensionLHD($finalId)
            ->vente($vendu)
            ->carcasse($carcasse)
            ->dimension($idDimension)
            ->idOccasion($id)
            ->get();

        return redirect("/recherche/occasion/search")->with(compact('occasions'));
    }

Here, I'm redirecting on a different URL with my big "occasion" variable, and on the other part of the controller, I just have this :

public function search()
    {
        dd('test');

        return view('recherche.occasion');
    }

My DD is working, but I don't know how to get my occasion variable to this function and use it in my vue, it returns nothing even with the compact('occasion')

So if you have an idea that could help me, I thank you in advance !

03 Aug
1 year ago

iGenezys left a reply on Jquery Autocomplete

Edit :

There was two arrays in the json, I removes the [] in [$return_array] and it's fine.

iGenezys started a new conversation Jquery Autocomplete

Hi guys.

I tried to do some autocomplete with json in Laravel, for me it's working, but when I want to type in my input, the autocomplete field does not display correctly.

I have my code like this :

{{ Form::open() }}
{{ Form::label('auto', 'Find a color: ') }}
{{ Form::text('auto', '', array('id' => 'auto')) }}
{{ Form::close() }}

<script type="text/javascript">
    $(function() {
        $("#auto").autocomplete({
            source: "autocomplete/getdata",
            minLength: 1,
        });
    });
</script>

And in my route I have my autocomplete/getdata route like this :

Route::get('autocomplete/getdata', function()
{
    $term = Str::lower(Input::get('term'));
    $data = array(
        'R' => 'Red',
        'O' => 'Orange',
        'Y' => 'Yellow',
        'G' => 'Green',
        'B' => 'Blue',
        'I' => 'Indigo',
        'V' => 'Violet',
    );
    $return_array = array();

    foreach ($data as $k => $v) {
        if (strpos(Str::lower($v), $term) !== FALSE) {
            $return_array[] = array('value' => $v, 'id' =>$k);
        }
    }
    return \Response::json([$return_array]);
});

But when i'm typing, my field is like this :

http://hpics.li/790ea3d

It seems like it's working, but it's not diplaying my result. Do you have some ideas that could help me ? Thank you in advance !

02 Aug
1 year ago

iGenezys started a new conversation Php-to-js Array + JQuery Autocomplete

Hi guys.

I would like to have a php array in JS for using it with jQuery Autocomplete. I use the php-to-js converter package for this, but when i'm doing it, the jQuery Autocomplete go crazy.

My arrays are full like this :

dimension = Dimension::with('largeur', 'hauteur', 'diametre')->get();
 
        foreach($dimension as $dim){
            $dimLargeur = $dim->largeur->largeur;
            $dimHauteur = $dim->hauteur->hauteur;
            $dimDiametre = $dim->diametre->diametre;
 
            $dimensions = "$dimLargeur/$dimHauteur-$dimDiametre";
            $aDimId[] = $dim->id;
            $aDim[] = $dimensions;
        }

And I put it on Php-to-js like this :

JavaScript::put([
            'dim' => $aDimId,
            'id' => $aDim,
        ]);

Here's my jQuery Autocomplete code :

<script type="text/javascript">
    $( function() {
        console.log(dim);
        console.log(id);
        var dimensions = dim;
        $( "#dimension" ).autocomplete({
            source: dimensions
        });
    } );
</script>

I correctly have my values when I go on the chrome's console :

http://hpics.li/f908fb6

But when I start to type on my input, the Autocomplete go wrong :

http://hpics.li/0fad535

When I use fixed values, the autocomplete went well, don't know why here it's not working.

If you have some ideas that can help me, thank you in advance !

20 Jul
2 years ago

iGenezys left a reply on How To Know If A SQL Request Return Something

@tykus I didn't explained myself very well, i'm not good in englis sorry. Actually it returns me an empty collection

@kheengz I did three scopes, becauseif I do like you, if I let an empty input, it will count it in the sql request, like this I can let one or some empty fields.

@Cronix Thank you, the isempty method was right and I found the collection page on the laravel doc !

iGenezys started a new conversation How To Know If A SQL Request Return Something

Hi guys. I have a SQL request with three inputs in my form, like that :

$dimLHD = Dimension::getLargeur($largeur)
                ->getHauteur($hauteur)
                ->getDiametre($diametre)
                ->get();

But here, if the SQL request is wrong and returns nothing (for example if my request is select * from dimension where largeur_id = 10 and hauteur_id = 70, there is no results) I get an undefined variable $dimLHD error.

I tried to do if(!$dimLHD) or if($dimLHD === null) some things like that, and it never works.

So do you have an idea that can help me to verify if my SQL request return something ?

Thank you in advance !

13 Jul
2 years ago

iGenezys started a new conversation Laravel + Jquery Autocomplete

Hi guys.

I have in my database something like 415 tyre dimensions. In a form I have an Input text with jQuery autocomplete, and it works with all my dimensions.

But now, when I choose my dimension, I would like to get the ID of the dimension for my select in the database, and I don't know how to do that, I'm just beginning JS.

I'm using the php-to-js var transformer for the app.

Here's my code :

controller :

JavaScript::put([
            'dim' => $aDimFinal['dimension'],
            'id' => $aDimFinal['id'],
        ]);

$aDimFinal is an array with my dimensions on a side, and the ids in an other.

and my JS code :

<script type="text/javascript">
    $( function() {
        console.log(dim);
        console.log(id);
        var dimensions = dim;
        $( "#dimension" ).autocomplete({
            source: dimensions
        });
    } );
</script>

and there is nothing less that my input in the html form :

{!! Form::label('dimension', 'Dimension :') !!}
        {!! Form::text('dimension', null, ['class' => 'form-control dimension', 'id' => 'dimension']) !!}

Do you have an idea about what to do for getting my ids when i'm choosing a dimension in the input text ?

Thank You in advance, and sorry for my english !

13 May
2 years ago

iGenezys left a reply on Data Recovery With BelongsTo

okay, I forgot to specifie my field in the belongsTo, thank you for the help !

12 May
2 years ago

iGenezys started a new conversation Data Recovery With BelongsTo

Hi all

I have a table named "occasions" and in this table, I have an "agence" value that is the ID of the table "Agence". I would like to have the datas of an agence from the belongsTo method.

I'm not really good in english so I'm not sure that I explained my problem well, so some code will be more explicit :

My belongsTo method :

public function getAgence(){
        return $this->belongsTo('App\Agence');
    }

My controller :

public function search($agence = null)
    {
        if(!$agence)
        {
            return redirect()
                ->back()
                ->with('error', 'Merci de choisir une agence.');
        }
        else
        {
            $stock = Occasion::with('getAgence')->where('agence', $agence)->get();
            $agences = Agence::pluck('code', 'id');
            $agences->prepend('');
            return view('stock.main', compact('stock', 'agences'));
        }
    }

And in my view :

@if(isset($stock) && !empty($stock))
       <h2>Occasions de l'agence de {{ $stock->first()->getAgence->lieu }}</h2>
@endif

Actually I have a "trying to get property on a non object" and when I dd on the line $stock->first().... It return a Null value.

Do you have an idea on what I did wrong ? Thank you !

23 Apr
2 years ago

iGenezys left a reply on Laravel 5.4 Debian Error

Edit 2 : It was the permissions, I put the permissions on the storage folder, but not in the folders in storage, was that.

Tank you !

iGenezys left a reply on Laravel 5.4 Debian Error

I'm not really good in english and i'm not sure if it's your question, but I'm accessing my laravel public folder with a file "randochamps.conf" that I created on my server, and it's like that :

<VirtualHost *:80>
    
        ServerName league.leroy-thomas.fr
        DocumentRoot /var/www/randochamps/public/

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/randochamps/>
                AllowOverride All
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

I'm trying to access the index.php file in my public folder but I don't know why it doesn't work..

22 Apr
2 years ago

iGenezys started a new conversation Laravel 5.4 Debian Error

Hi everyone, I'm here because I have a problem;

I tried to install laravel 5.4 on my Debian 7. Everything works well, but when I want to access my website (league.leroy-thomas.fr), I got an error (in english) Unable to process this request via league.leroy-thomas.fr at the moment. Error 500.

The only things I did was make the full-permissions on my bootstrap/cache & storage folder. I put my PhpMyAdmin logs in the .env file and I tried to remove my .htaccess file. Nothing else.

I don't even have the first Laravel page, and I don't understand why.

If someone here had this error and solved it, do you have an idea ?

Thank You !

18 Mar
2 years ago

iGenezys left a reply on Hours Calculator

I never used Carbon, or tried to do something like this in Php.

I understand the thing, converting in minute and reconvert in hours + minutes. Actually I'm not using a database, I don't need it for the moment, can I do the convertion in this function and go in an other page with the result ?

I'll try to write something for convert my values in minutes, do you have a start of track for me ? I'll check the Carbon's doc.

iGenezys started a new conversation Hours Calculator

Hi. I wanted to create a little code, and with this code I can calculate my hours. But my problem is that I don't know how to calculate hours.

I try a code like that :

public function calcul(){
        $lundi = "00:30";
        $mardi = "02:30";
        $mercredi = "05:05";
        $jeudi = "02:40";
        $vendredi = "04:30";

        $total = $lundi + $mardi + $mercredi + $jeudi + $vendredi;

        dd($total);

    }

But here, it return me a 13 (02+05+02+04), it's not really what I want, I want it to return 15:30.

So I'm asking, is there a function that allow me to do my hours calculator ?

Thank you !

02 Mar
2 years ago

iGenezys started a new conversation Omnipays - Questions

Hi. I created a e-commerce website, and naturally, I want to make the payment. I didn't know where to go, so I choose Omnipay, there was a tutorial, I tried this.

Actually I just want to make the PayPal Payment, and next, I'll maybe need some other informations.

But now, I have an error. By following the tutorial, I make this code :

use Omnipay\Omnipay;

$gateway = Omnipay::create('PayPal_Express');
        $gateway->setUsername('t*********r');
        $gateway->setPassword('QLK9UXC3BW');
        $gateway->setSignature('AFcWCpSSRl31A04jGP3hIGDvH-FodEDWEsGPdgGP');

        $gateway->setTestMode(true);

        $response = $gateway->purchase([
            'cancelUrl' => '/',
            'returnUrl' => '/',
            'description'=>'Vente de test',
            'amount' => 50.00,
            'currency' => 'EUR'
        ])->send();

        $response->redirect();

When I click on my "process to payment" button, it should take me to the paypal payment page.

But I have an error "RuntimeException in AbstractResponse.php line 127: This response does not support redirection."

Do you know what did I wrong ? Or what to do for resolve this problem ?

23 Feb
2 years ago

iGenezys left a reply on [TokenField] $tokenfield.tokenfield Is Not A Function

"How about wrapping your code in a jquery document ready function?"

That was that !

I did that before but I forgot to reload the page or something like that.

Thank you !