PhoeniX5

PhoeniX5

Member Since 5 Months Ago

Experience Points 1,780
Experience Level 1

3,220 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-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.

22 Jul
13 hours ago

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

I managed to solve this by replacing this :

$modele = $request->mod;
            $produit = Produit::find($modele);
            dump($produit->id);
            die();
            if (empty($produit)) {
                exit(json_encode(['message' => "pas trouvé"]));
            }

            $id_produit = $produit->id;

By this :

$produit = DB::table('produits')->where('modele', $request->modele)->first();

And changing both the route method and the ajax method to from POST to GET.

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

Sorry, if I was not clear, I thought this might help to resolve the problem, these errors are the browser console display :

GET:

(Method Not Allowed)

POST:

produit:92 Uncaught TypeError: Cannot read property 'length' of undefined at Object.success (produit:92)

And if I open those in a new tab I get this error which is laravel error display :

"The GET method is not supported for this route. Supported methods: POST."

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

Thank you for your reply, but nothing has been resolved. If you read my whole post, you will see that the get method or the post method did not work and both give me the same error which is the title of the post.

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

With the get method I get this error :

POST http://127.0.0.1:8000/Inspection/produit/ns 405 (Method Not Allowed)

With the post method I get this error :

produit:92 Uncaught TypeError: Cannot read property 'length' of undefined
    at Object.success (produit:92)
    at i (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at z (jquery.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery.min.js:4)

When I try :

dump($request->modele);
die();

It shows :

null

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

Thank you for your reply, but as I already said the POST and the GET give me the same error.

PhoeniX5 left a reply on The GET Method Is Not Supported For This Route. Supported Methods: POST.

$ php artisan route:list +--------+----------+-----------------------+-----------------------+----------------------------------------------------------+--------------+ | Domain | Method | URI | Name | Action | Middleware | +--------+----------+-----------------------+-----------------------+----------------------------------------------------------+--------------+ | | GET|HEAD | / | | Closure | web | | | GET|HEAD | Inspection | | App\Http\Controllers\[email protected] | web | | | POST | Inspection/produit | | App\Http\Controllers\[email protected]_modele | web | | | POST | Inspection/produit/ns | inspection.produit.ns | App\Http\Controllers\[email protected] | web | | | GET|HEAD | Magasin | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | Produit | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | Type_produit | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | Type_produit/fetch | Type_produit.fetch | App\Http\Controllers\[email protected] | web | | | GET|HEAD | api/user | | Closure | api,auth:api | | | GET|HEAD | login | | App\Http\Controllers\[email protected] | web | | | POST | login/checklogin | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | login/logout | | App\Http\Controllers\[email protected] | web | | | GET|HEAD | magasin/ajtqte | magasin.ajtqte | App\Http\Controllers\[email protected] | web | | | GET|HEAD | magasin/getMag | magasin.getMag | App\Http\Controllers\[email protected] | web | | | GET|HEAD | produit/fetchdata | produit.fetchdata | App\Http\Controllers\[email protected] | web | | | GET|HEAD | produit/getPro | produit.getPro | App\Http\Controllers\[email protected] | web | | | GET|HEAD | produit/modifier | produit.modifier | App\Http\Controllers\[email protected] | web | | | GET|HEAD | produit/upd | produit.upd | App\Http\Controllers\[email protected] | web | | | GET|HEAD | validate/magasin | validate.magasin | App\Http\Controllers\[email protected] | web | | | GET|HEAD | validate/produit | validate.produit | App\Http\Controllers\[email protected] | web | +--------+----------+-----------------------+-----------------------+----------------------------------------------------------+--------------+

PhoeniX5 started a new conversation The GET Method Is Not Supported For This Route. Supported Methods: POST.

I am developing an application where I have to submit a form, with some values of this form, get the corresponding values from other MySQL tables and submit it to a table, the problem is that I keep having this error, I tried POST instead of GET but always the same error. Here is my code:

View:

$('#form_inspection').on('submit', function(event){
        event.preventDefault();
        var form_data = $(this).serialize();
        $.ajax({
            url:"{{ route('inspection.produit.ns') }}",
            method:"get",
            data:form_data,
            dataType:"json",
            success:function(data)
            {
                if(data.error.length > 0)
                {
                    var error_html = '';
                    for(var count = 0; count < data.error.length; count++)
                    {
                        error_html += '<div class="alert alert-danger">'+data.error[count]+'</div>';
                    }
                    $('#form_output').html(error_html);
                }
                else
                {
                    $('#form_output').html(data.success);
                    $('#form_inspection')[0].reset();
                }
            }
        })
    });

Controller :

function inspection(Request $request) {
        $validation = Validator::make($request->all(), [
            'modele'     =>  'min:0',
            'couleur'    =>  'min:0',
            'n_serie'    =>  'min:0',
            //'etat_panne' =>  'min:0',
            //'poste'      =>  'min:0',
        ]);

        $error_array = array();
        $success_output = '';
        if ($validation->fails())
        {
            foreach($validation->messages()->getMessages() as $field_name => $messages)
            {
                $error_array[] = $messages;
            }
        }
        else
        {
            $modele = $request->modele;
            $produit = Produit::find($modele);
            if (empty($produit)) {
                exit(json_encode(['message' => "pas trouvé"]));
            }
           
            $id_produit = $produit->id;
            $ns = new Log_ns([
                'id_produit'    =>  $id_produit,
                'n_s'           =>  $request->get('n_s'),
                'couleur'       =>  $request->get('color'),
                'etat_panne'    =>  $request->get('etat_panne'),
                'panne'         =>  $request->get('panne'),
                'remarque'      =>  $request->get('remarque'),
                'poste'         =>  ('1'),
            ]);
            $ns->save();
            $success_output = '<div class="alert alert-success">Produit ajouté</div>';
        }
        $output = array(
            'error'     =>  $error_array,
            'success'   =>  $success_output
        );
        echo json_encode($output);
    }

Route :

Route::post('Inspection/produit/ns', '[email protected]')->name('inspection.produit.ns');

16 Jul
6 days ago

PhoeniX5 left a reply on How To Populate A Drop Dropdown Menu From Another Drowdown Menu ?

Thank you for your replys, I managed to make a dynamic drop down menu on my own ;)

here is my code :

View :

<form method="POST" id="type_produit">
            <br />
            <div class="container box">
                <br />
                <div class="form-group">
                    <select name="produit" id="produit" class="form-control input-lg dynamic" data-dependent="modele">
                        <option value="">Sélectionner le Produit</option>
                        @foreach($produit_list as $produit)
                        <option value="{{ $produit->produit}}">{{ $produit->produit }}</option>
                        @endforeach
                    </select>
                </div>
                <br />
                <div class="form-group">
                    <select name="modele" id="modele" class="form-control input-lg dynamic" data-dependent="id">
                        <option value="">Sélectionner le modele</option>
                    </select>
                </div>
                <br />
                <div class="form-group">
                    <select name="couleur" id="couleur" class="form-control input-lg">
                        <option value="">Sélectionner la couleur</option>
                    </select>
                </div>
                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                <br />
            </div>
        </form>


$(document).ready(function() {

            $('.dynamic').change(function(){
                if($(this).val() != '')
                {
                var select = $(this).attr("id");
                var value = $(this).val();
                var dependent = $(this).data('dependent');
                var _token = $('input[name="_token"]').val();
                $.ajax({
                    url:"{{ route('Type_produit.fetch') }}",
                    method:"GET",
                    data:{select:select, value:value, _token:_token, dependent:dependent},
                    success:function(result)
                    {
                    $('#'+dependent).html(result);
                    }
                })
                }
            });

            $('#produit').change(function(){
            $('#modele').val('');
            $('#couleur').val('');
            });

        });

Controller:

function getModele(Request $request)
    {
        $produit_list = DB::table('produits')
            ->groupBy('id')
            ->get();
        return view('Type_produit')->with('produit_list', $produit_list);
    }

    function fetch(Request $request)
       {
        $select = $request->get('select');
        $value = $request->get('value');
        $dependent = $request->get('dependent');
        $data = DB::table('produits')
          ->where($select, $value)
          //->groupBy($dependent)
          ->get();
        $output = '<option value="">Select '.ucfirst($dependent).'</option>';
        foreach($data as $row)
        {
         $output .= '<option value="'.$row->$dependent.'">'.$row->$dependent.'</option>';
        }
        echo $output;
    }

Root :

Route::get('/Type_produit', '[email protected]');

Route::get('Type_produit/fetch', '[email protected]')->name('Type_produit.fetch');`

PhoeniX5 left a reply on How To Populate A Drop Dropdown Menu From Another Drowdown Menu ?

Thank you for your reply, when I try to run this code nothing happens :

$("#md_menu li a").click(function(){
            $.ajax({
                    type: "GET",
                    dataType: "json",
                    url: "{{ url('Type_produit/getproduit')}}",
                    data: $('#type_produit_form').serialize(),
                    success: function (data) {
                        if (data.error === 0) {
                            $.each(data.prDropDown, function (key, value) {
                                $('#md_dropdown-toggle').append("<option value='" + key + "' selected ='selected'>" + value + "</option>");
                            });
                        } else {
                            swal('Whoops', data.message, 'warning');
                        }
                    },
            });
        });
14 Jul
1 week ago

PhoeniX5 started a new conversation How To Populate A Drop Dropdown Menu From Another Drowdown Menu ?

I am developing an application where I need to populate a dropdown menu with values related to the value selected in the previous dropdown menu all the values are from database, how populate the second dropdown menu ?

Here is my code:

View:

<form method="POST" id="">
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <div class="form-group">
                <div class="dropdown">
                    <button class="btn btn-default dropdown-toggle" type="button"
                        data-toggle="dropdown" id="pr_dropdown-toggle">Choisissez le type du produit
                    <span class="caret"></span></button>
                    <ul class="dropdown-menu" id="pr_menu">
                        @if (isset($prDropDown))
                            @foreach($prDropDown as $id => $produit)
                                <li><a href="#" >{{$produit}}</a></li>
                            @endforeach
                        @endif
                    </ul>
                </div>
            </div>
            <div class="form-group">
                <div class="dropdown">
                    <button class="btn btn-default dropdown-toggle" type="button"
                        data-toggle="dropdown" id="md_dropdown-toggle">Choisissez le modèle
                        <span class="caret"></span></button>
                    <ul class="dropdown-menu" id="md_menu">

                    </ul>
                </div>
            </div>           
        </form>
    </div>
    <br />

    <script type="text/javascript">
    $(document).ready(function() {
        $("#pr_menu li a").click(function(){
            $('.selectedLi').removeClass('selectedLi');
            $(this).addClass('selectedLi');
            var selText = $(this).text();
            $("#pr_dropdown-toggle").html(selText+
            ' <span class="caret"></span>');
            $("#produit").val(selText);
        });

        $("#md_menu li a").click(function(){
            $('.selectedLi').removeClass('selectedLi');
            $(this).addClass('selectedLi');
            var selText = $(this).text();
            $("md_#dropdown-toggle").html(selText+
            ' <span class="caret"></span>');
            $("#produit").val(selText);
        });

Controller:

public function getElectronics() {
        $prDropDown = Produit::groupBy('produit')->pluck('produit');
        return view('Type_produit', compact('prDropDown'));
    }

Route:

Route::get('Type_produit/getproduit', '[email protected]');
03 Jul
2 weeks ago

PhoeniX5 left a reply on How To Populate A Dropdown Menu From Database ?

I managed to populate the dropdown menu with data from MySQL database, now I need to trigger it. Here is my code : View :

<div class="form-group">
                <label for="City">Choisissez un produit</label>
                <select name="dropdownPr" class="form-control">
                  @if (isset($prDropDown))
                  @foreach($prDropDown as $id => $produit)
                  <option value="{{$id }}" >{{$produit}}</option>
                  @endforeach
                 @endif
                </select>
            </div>

Controller :

public function getProducts() {
        $prDropDown = Produit::pluck('produit', 'id');
        return view('Type_produit', compact('prDropDown'));
    }

How to trigger this dropdown menu when you select a value, it populates a second drop-down menu with values related to the value selected in the first drop-down menu.

02 Jul
2 weeks ago

PhoeniX5 left a reply on How To Populate A Dropdown Menu From Database ?

@TYKUS - Please be yourself and keep doing what you do because it's very useful and it allows me to learn.

PhoeniX5 left a reply on How To Populate A Dropdown Menu From Database ?

@TYKUS - Yes, I need to store the submitted data in MySQL table

PhoeniX5 left a reply on How To Populate A Dropdown Menu From Database ?

@TYKUS - Yes, I do.

<script type="text/javascript">

</script>

PhoeniX5 left a reply on How To Populate A Dropdown Menu From Database ?

@TYKUS - Thank you for your reply, can you please provide me with the working solution code ?

PhoeniX5 left a reply on How To Send Value From Dropdown To The Controller Via Ajax ?

@MVD - Thank you for your reply i managed to do this by adding a hidden field and submitting this field with the selected value from the dropdown menu.

PhoeniX5 started a new conversation How To Fill A Dropdown Menu From Database ?

I need to fill a dropdown menu with values from MySQL database and trigger it when selecting a value it fills a second dropdown menu with the values related to the selected value from the first dropdown menu. Here is my dropdown menu :

<div class="form-group">
                <div class="dropdown">
                    <button class="btn btn-default dropdown-toggle" type="button"
                        data-toggle="dropdown" id="dropdown-toggle">Choisissez le modèle
                        <span class="caret"></span></button>
                    <ul class="dropdown-menu">
                        <li class="dropdown-header">Phone</li>
                        <li><a href="#">Smartphone</a></li>
                        <li><a href="#">Featurephone</a></li>
                        <li class="divider"></li>
                        <li class="dropdown-header">TV</li>
                        <li><a href="#">SmartTV</a></li>
                        <li><a href="#">BasicTV</a></li>
                        <li><a href="#">Demodulateur</a></li>
                    </ul>
                </div>
            </div>
        </div>
13 Jun
1 month ago

PhoeniX5 left a reply on How To Send Value From Dropdown To The Controller Via Ajax ?

@MVD - Can you pls show me how to get the selected value in the controller like below :

$pr = new Produit([
                    'produit'              =>  $request->get('produit'),
                    'modele'               =>  $request->get('modele'),
                    ...
                ]);
                $pr->save();
12 Jun
1 month ago

PhoeniX5 left a reply on How To Send Value From Dropdown To The Controller Via Ajax ?

@MVD - Thank you for your reply, what I meant is how to submit the selected value from the following dropdown menu :

<div class="form-group">
    <div class="dropdown">
        <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">Choisissez le type du prduit<span class="caret"></span></button>
            <ul class="dropdown-menu">
                <li class="dropdown-header">Phone</li>
                <li><a href="#">Smartphone</a></li>
                <li><a href="#">Featurephone</a></li>
                <li class="divider"></li>
                <li class="dropdown-header">TV</li>
                <li><a href="#">SmartTV</a></li>
                <li><a href="#">BasicTV</a></li>
                <li><a href="#">Demodulateur</a></li>
            </ul>
    </div>
</div>

I often have the values of the form fields by assigning a name to each entry but in this case I have 5 entries in a single entry.

PhoeniX5 started a new conversation How To Send Value From Dropdown To The Controller Via Ajax ?

I need to get selected value from a drop down menu and send it to the controller via ajax method. Here is my code :

<div class="form-group">
                            <div class="dropdown">
                                <button class="btn btn-default dropdown-toggle" type="button"
                                    data-toggle="dropdown">Choisissez le type du prduit
                                    <span class="caret"></span></button>
                                <ul class="dropdown-menu">
                                    <li class="dropdown-header">Phone</li>
                                    <li><a href="#">Smartphone</a></li>
                                    <li><a href="#">Featurephone</a></li>
                                    <li class="divider"></li>
                                    <li class="dropdown-header">TV</li>
                                    <li><a href="#">SmartTV</a></li>
                                    <li><a href="#">BasicTV</a></li>
                                    <li><a href="#">Demodulateur</a></li>
                                </ul>
                            </div>
                        </div>







$('#pr_form').on('submit', function(event){
        event.preventDefault();
        var form_data = $(this).serialize();
        $.ajax({
            url:"{{ route('produit.upd') }}",
            method:"GET",
            data:form_data,
            dataType:"json",
            success:function(data)
            {
                if(data.error.length > 0)
                {
                    var error_html = '';
                    for(var count = 0; count < data.error.length; count++)
                    {
                        error_html += '<div class="alert alert-danger">'+data.error[count]+'</div>';
                    }
                    $('#form_output').html(error_html);
                }
                else
                {
                    $('#form_output').html(data.success);
                    $('#pr_form')[0].reset();
                    $('#pr_table').DataTable().ajax.reload();
                }
            }
        })
    });
11 Jun
1 month ago

PhoeniX5 started a new conversation Problem When Running Multiple Event

I am developing an application in which I need to update some MySQL database values using laravel datatables. The problem is that when I perform my function, the second part does not run! Here is my code :

$('#qte_form').on('submit', function(event){
        var newqte = parseInt($("#qte_ajt").val()) + parseInt($("#prev_qte").val());
        $("#new_qte").val(newqte);
        console.log($("#new_qte").val());
        event.preventDefault();
        var form_data = $(this).serialize();
        if(confirm("Êtes-vous sûr de cette quantité?"))
        {
            $.ajax({
                url:"{{route('magasin.ajtqte')}}",
                method:"get",
                data:form_data,
                dataType:"json",
                success:function(data)
                {
                    if(data.error.length > 0)
                    {
                        var error_html = '';
                        for(var count = 0; count < data.error.length; count++)
                        {
                            error_html += '<div class="alert alert-danger">'+data.error[count]+'</div>';
                        }
                        $('#form_output').html(error_html);
                    }
                    else//not running
                    {
                        alert(data);
                        $('#form_output').html(data.success);
                        $('#qte_form')[0].reset();
                        $('#p_table').DataTable().ajax.reload();
                    }
                }
            })
        }
        else
        {
            return false;
        }
    });
10 Jun
1 month ago

PhoeniX5 left a reply on How To Get A Value In Js From Laravel Datatable Cell ?

I managed to get the cell value but i am getting undefined value when trying to update, Here is my code :

$('#qte_form').on('submit', function(event){
        event.preventDefault();
        var form_data = $(this).serialize();
        ...
        var newqte = parseInt($("#qte").val()) + parseInt(prev);
        $("#qte_ajt").val(newqte);
        console.log($("#qte").val());//undefined
...
09 Jun
1 month ago

PhoeniX5 started a new conversation How To Get A Value In Js From Laravel Datatable Cell ?

I am developing an application where i need to get a value from a datatable cell by a button click then update this value in js

PhoeniX5 left a reply on Too Few Arguments To Function

Thank you for your reply, i found another way to do this

28 May
1 month ago

PhoeniX5 left a reply on Too Few Arguments To Function

@SNAPEY - Thank you for your reply, now i am getting this error:

"Action App\Http\Controllers\[email protected] not defined. (View: C:\Users\...\resources\views\edit.blade.php)"
26 May
1 month ago

PhoeniX5 started a new conversation Too Few Arguments To Function

I am developing an application where i need to edit and update view with MySql table but i keep getting this error :

"Too few arguments to function App\Http\Controllers\UtilisateursController::modifier(), 0 passed and exactly 1 expected"

Controller:

function modifier($id) {
        $mag = Produit::find($id);
        return view('edit', compact('edit', 'id'));
    }

    function update(Request $req, $id) {
        $this->validate($req, [
            'produit'               =>   'required',
            'modele'                =>   'required',
            'kit'                   =>   'required',
            'job_number'            =>   'required',
            'couleur'               =>   'required',
            'qte_couleur'           =>   'required',
            'piece_par_carton'      =>   'required',
            'carton_par_pallete'    =>   'required'
        ]);

        $pr = Produit::find($id);
        $pr->produit = $req->get('produit');
        $pr->modele = $req->get('modele');
        $pr->kit = $req->get('kit');
        $pr->job_number = $req->get('job_number');
        $pr->couleur = $req->get('couleur');
        $pr->qte_couleur = $req->get('qte_couleur');
        $pr->piece_par_carton = $req->get('piece_par_carton');
        $pr->carton_par_pallete = $req->get('carton_par_pallete');
        $pr->save();
        return redirect()->route('Produit')->with('success', 'Modifié');
    }

View:

$(document).on('click', '.Modifier', function(){
        var id = $(this).attr('id');
        console.log(id);
        if(confirm("Êtes-vous sûr de vouloir modifier ce produit?"))
        {
            $.ajax({
                url:"{{route('produit.modifier')}}",
                mehtod:"get",
                data:{id:id},
                    success:function(data)
                    {
                        alert(data);
                        $('#pr_table').DataTable().ajax.reload();
                    }
            })
        }
        else
        {
            return false;
        }
    });

edit view:

<div class="row">
        <div class="cold-md-12">
            <br />
            <h3>Modifier</h3>
            <br />
            @if(count($errors) >0)
            <div class="alert alert-danger">
                <ul>
                    @foreach($errors->all() as $error)
                    <li>$error</li>
                    @endforeach
                </ul>
            </div>
            @endif
            <form method="post" action="{{action('[email protected]', '$id')}}">
                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                <input type="hidden" name="_method" value="PATCH">
                <div class="form-group">
                    <label>...
15 May
2 months ago

PhoeniX5 left a reply on DataTables Error

@DEVFREY - This is it:

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.8.*",
        "laravel/tinker": "^1.0",
        "yajra/laravel-datatables": "^1.0",
        "yajra/laravel-datatables-oracle": "^7.0"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.5"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\Foundation\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}

PhoeniX5 left a reply on DataTables Error

@SUJANCSE - Still same error

PhoeniX5 left a reply on DataTables Error

@SUJANCSE - I get this error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - yajra/laravel-datatables 1.0.x-dev requires yajra/laravel-datatables-buttons 4.* -> satisfiable

PhoeniX5 left a reply on DataTables Error

@DEVFREY - I am getting this error :

[InvalidArgumentException]
  Could not find package yajra/laravel-datatables in a version matching ^9.0

PhoeniX5 left a reply on DataTables Error

@RESPECT - I tried every version from ^1.0 to ^8.0

PhoeniX5 started a new conversation DataTables Error

Hello, I am trying to install DataTables in my laravel app but I keep getting errors while running this command :

composer require yajra/laravel-datatables-oracle:^8.0

Error:

$ composer require yajra/laravel-datatables-oracle:^8.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove laravel/framework v5.8.10
    - Conclusion: don't install laravel/framework v5.8.10
    - yajra/laravel-datatables-oracle 8.0.x-dev requires illuminate/view 5.4.*|5.5.*|5.6.*|5.7.* -> satisfiable by illuminate/view[5.4.x-dev,...

Installation failed, reverting ./composer.json to its original content.
25 Apr
2 months ago

PhoeniX5 started a new conversation Laravel Error "array_map(): Argument #2 Should Be An Array"

I am developing an application but i keep getting this error:

"array_map(): Argument #2 should be an array"

Here is my code: Controller:

function magasin(Request $request) {
        $validation = Validator::make($request->all(), [
            'article'     =>  $request->get('article'),
            'qte_s'       =>  $request->get('qte_s'),
            //'qte_e'       =>  $request->get('qte_e'),
        ]);

        $error_array = array();
        $success_output = '';
        if ($validation->fails())
        {
            foreach($validation->messages()->getMessages() as $field_name => $messages)
            {
                $error_array[] = $messages;
            }
        }
        else
        {
            $mag = new Magasin([
                'article'     =>  $request->get('article'),
                'qte_s'       =>  $request->get('qte_s'),
                //'qte_e'       =>  $request->get('qte_e')
            ]);
            $mag->save();
            $success_output = '<div class="alert alert-success">Produit ajouté</div>';
        }
        $output = array(
            'error'     =>  $error_array,
            'success'   =>  $success_output
        );
        echo json_encode($output);
    }

View:

<script type="text/javascript">
        $(document).ready(function() {

    $(document).on('click', '#pub', function(){
        $('#magModal').modal('show');
    });

    $('#mag_form').on('submit', function(event){
    event.preventDefault();
    var form_data = $(this).serialize();
    $.ajax({
        url:"{{ route('validate.magasin') }}",
        method:"get",
        data:form_data,
        dataType:"json",
        success:function(data)
        {
            if(data.error.length > 0)
            {
                var error_html = '';
                for(var count = 0; count < data.error.length; count++)
                {
                    error_html += '<div class="alert alert-danger">'+data.error[count]+'</div>';
                }
                $('#form_output').html(error_html);
            }
            else
            {
                $('#form_output').html(data.success);
                $('#mag_form')[0].reset();
            }
        }
    })
    });
});
    </script>
19 Mar
4 months ago

PhoeniX5 started a new conversation 404 Not Found The Resource Requested Could Not Be Found On This Server!

I need to host my Laravel app in internet so far the only working url is the first one without the controller if i try access /support i or any other url with controller i get :

404
Not Found
The resource requested could not be found on this server!

Here is my code :

Route::get('/', function(){ //only working url
    return view('Demo.support');
});

Route::get('/support', '[email protected]');

Route::get('/support/postdata', '[email protected]')->name('support.postdata');

Route::get('/support/requete', '[email protected]')->name('support.requete');

Route::get('/support/getetat', '[email protected]')->name('support.getetat');

Route::post('/support/checklogin', 'DemoCont[email protected]');
Route::get('admin/logout', '[email protected]');
Route::get('/admin', '[email protected]');

Route::get('admin/getRequete', '[email protected]')->name('admin.getRequete');

Route::get('admin/reponse', '[email protected]')->name('admin.reponse');

Route::get('admin/fetchdata', '[email protected]')->name('admin.fetchdata');

Is there a way to transform all the other urls like the first one without loosing anything ?

PhoeniX5 left a reply on Namespace Declaration Statement Has To Be The Very First Statement Or After Any Declare Call In The Script

@MANELGAVALDA - <?php is the first thing in the page, here is a part of code from beginning :

<?php

namespace App\Http\Controllers;

use Validator;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use App\Demo;
use DB;
use Auth;
use Yajra\DataTables\DataTables;

class DemoController extends Controller
{
    public $code;
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return view('demo.support');
    }

PhoeniX5 started a new conversation Namespace Declaration Statement Has To Be The Very First Statement Or After Any Declare Call In The Script

I need to host my Laravel app in internet when running it in local server it works without issues but in the internet server it keeps saying :

Namespace declaration statement has to be the very first statement or after any declare call in the script

This is my namespace :

<?php
namespace App\Http\Controllers;

14 Mar
4 months ago

PhoeniX5 left a reply on How To Display Views When Hosting A Laravel Project On Internet ?

@PARDEEPKUMAR - I checked everything seems fine, but i keep getting error HTTP 500.

PhoeniX5 left a reply on How To Display Views When Hosting A Laravel Project On Internet ?

@JLRDW - I need to host my app in a shared server, so I downloaded my app in the server then I imported the database but i have no views, how do I display my views as in a local server (127.0.0.1:8000/support) as (subdomain/support), like in the route file ?

13 Mar
4 months ago

PhoeniX5 started a new conversation How To Access Views When Hosting A Laravel Project ?

I need to access to my view folder and files instead of the index file when hosting my Laravel app, so far i have access to the index files but i am not using it, so i need to access to views in ressources folder.

12 Mar
4 months ago

PhoeniX5 left a reply on How To Use A Custom Form Validator In Laravel ?

@STEREOH - I need to make each field required (*), how to trigger each field for that to display each error message on top of it's specific field instead ?

PhoeniX5 started a new conversation How To Use A Custom Form Validator In Laravel

I need to use Laravel validator to show only a single meesage if something wrong because in my case i have form with 7 fields that are all required, when using Laravel validator on submit it shows an error message for every field which is 7 messages in total, that's making my view a mess, if this is not possible with Laravel validator, which custom validator should I use and how do I use it ?

07 Mar
4 months ago

PhoeniX5 left a reply on Laravel Wrong Data Display From MySql Table !

@MUNAZZIL - Thank you for your reply, i updated my code please take a look.

PhoeniX5 left a reply on Laravel Wrong Data Display From MySql Table !

@MUNAZZIL - Thank you for your reply, but the field name is 'id' in MySql table, i updated my code.

PhoeniX5 left a reply on Laravel Wrong Data Display From MySql Table !

@TGRASSMEE - @TGRASSMEE - I mean I am getting random numbers display in field id that does not correspond to what i have in my MySql table.

PhoeniX5 started a new conversation Laravel Wrong Data Display From MySql Table !

I need to display data from MySql table in Laravel view but it keeps showing a wrong data inside the field id, the other fields are displayed correctly, here is code :

View :

$(document).ready(function() {
                    $('#req_table').DataTable({
                        "processing": true,
                        "serverSide": true,
                        "ajax": "{{ route('admin.getRequete') }}",
                    "columns":[                    
                            { "data": "id" },
                            { "data": "nom" },
                            { "data": "prenom"},
                            { "data": "reference"},
                            { "data": "n_mac" },
                            { "data": "n_serie" },
                            { "data": "probleme_survenu"},
                            { "data": "plus_infos"},
                            { "data": "reponse"},
                            { "data": "action"}
                        ]           
                    });...

Controller :

function getRequete()
    {
        $reqs = Demo::select('id', 'nom', 'prenom', 'reference', 'n_mac', 'n_serie', 'probleme_survenu', 'plus_infos', 'reponse');
        $result = DataTables::of($reqs)  
                ->addColumn('action', function($req){
                    return '<a href="#" class="btn btn-xs btn-primary req_reponse" id="'.$req->ID.'"><i class="glyphicon glyphicon-edit"></i> Modifier la réponse</a>';})
                ->make(true);
        return $result ;
    }

Root :

Route::get('admin/getRequete', '[email protected]')->name('admin.getRequete');
06 Mar
4 months ago

PhoeniX5 left a reply on Laravel Update MySQL Table Failure

@MVD - I only had to rename ID to id thank you.