jpmg

jpmg

Member Since 9 Months Ago

Experience Points 460
Experience Level 1

4,540 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.

19 Feb
5 months ago

jpmg left a reply on Problem To Create A Print Button In Jquery To Laravel

i try like you say with.

var algo = '{{ action([email protected], [ido => ' + iddremito + ']) }}';

Now i get this error:

window.location.href={{ action([email protected], [ido => 22]) }}
Uncaught SyntaxError: Unexpected token {

jpmg started a new conversation Problem To Create A Print Button In Jquery To Laravel

I have a problem I want to create a print button after the user save it can print a pdf, the save button it's working and after save i return the id, but im trying to make a button with my id to print.. i make my button in jquery like this..

''' $.ajax({ url: "guardarelremitofinal", method: "POST", data: datastring, success:function(data){ // var corte=data.indexOf("@",0); var fin=data.leng; var id=data.substring(0,corte); corte=corte+1; var mensajg =data.substring(corte,fin); //

 var mensaje = '<div class="alert alert-success">Se Registro exitosamente el remito!!</div>';
$('#finderemito').show();
$('#guardaremito').hide();
$('#botonimprimir').show();
var algo= "'{{action([email protected], [ido=>"+id+"])}}'";
var paraimir = '<button type="button" class="btn btn-dark btn-circle" onclick= "window.location.href='+algo+'"> <i class="fa fa-print" title="Imprimir"></i></button>';
 $('#botonimprimir').html(paraimir);
  $('#finderemito').html(mensaje);

'''

the button show if save successful but when the user click in my print button it doesn't work, in my navegacion bar i get this error.

''' http://localhost/hidrofrac/public/%7B%7Baction([email protected],%20[ido=%3E21])%7D%7D ''' my route

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

can some please help me?? thanks

13 Feb
5 months ago

jpmg left a reply on Problem Usin Fineuploader In Laravel..

Ok Sir. I will read it and post my advance tomorrow. thank you!

12 Feb
5 months ago

jpmg left a reply on Problem Usin Fineuploader In Laravel..

Sr. I using windows and i look folder property users can read and write!!

jpmg started a new conversation Problem Usin Fineuploader In Laravel..

Good morngin forum, I have a problem using fineuploader, i can browse the image and in my browser network tools i get this message..

[Fine Uploader 5.16.2] '1a.jpg' is  able to be rendered in this browser util.js:236 
[Fine Uploader 5.16.2] Moving forward with EXIF header parsing for '1a.jpg' util.js:236 
[Fine Uploader 5.16.2] EXIF Byte order is big endian util.js:236 
[Fine Uploader 5.16.2] Found 11 APP1 directory entries util.js:236 
[Fine Uploader 5.16.2] Successfully parsed some EXIF tags 

but when i whant to upload the image i get tis error message.

<p>You don't have permission to access /hidrofrac/public/files/ on this server.<br /></p>
<p>Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle           
      the request.</p>
<hr><address>Apache/2.4.34 (Win32) OpenSSL/1.1.0i PHP/7.2.9 Server at localhost Port 80</address>
util.js:241 [Fine Uploader 5.16.2] Error when attempting to parse xhr response text (Unexpected token < in JSON at position 0)

My jquery is:

var manualUploader = new qq.FineUploader({ debug: true, element: document.getElementById('fine-uploader-manual-trigger'), template: 'qq-template-manual-trigger', request: { endpoint: 'files' }, thumbnails: { placeholders: { waitingPath: '/fine-uploader/placeholders/waiting-generic.png', notAvailablePath: '/fine-uploader/placeholders/not_available-generic.png' } }, autoUpload: false, debug: true });
    qq(document.getElementById("trigger-upload")).attach("click", function() {
        manualUploader.uploadStoredFiles();
    });
</script>

My apache log says..

[pid 17376:tid 2008] [client ::1:54707] AH01276: Cannot serve directory         
C:/xampp/htdocs/hidrofrac/public/files/: No matching DirectoryIndex 
(index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,default.php,default.pl,default.cgi ,default.asp,default.shtml,default.html,default.htm,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm) found, and server-generated directory index forbidden by Options directive, referer: http://localhost/hidrofrac/public/home
    [pid 17376:tid 2008] [client ::1:54707] AH00690: no acceptable variant: C:/xampp/apache/error/HTTP_FORBIDDEN.html.var, referer: http://localhost/hidrofrac/public/home

I tried all what i found in the web, but nothing works for mi, can someone help me?

10 Feb
5 months ago

jpmg left a reply on Problem In Request

ok i will read it!

jpmg left a reply on Problem In Request

Close conversation

jpmg left a reply on Problem In Request

thank so much Sr is working now, what i did is to use encodeURIComponent and now is working!! From Venezuela Thank so much...

jpmg left a reply on Problem In Request

Sr. in my network tools also prints Brothers

jpmg left a reply on Problem In Request

Sr. I tried like you say with dd() and print only Brothers

08 Feb
5 months ago

jpmg left a reply on Problem In Request

Is POST

jpmg left a reply on Problem In Request

In my jquery

function GuarPY() {

$('#form_output').hide(); $('#form_output').show(); var token = $("#token").val(); var tipooperacion = $("input[name='typ']:checked").val(); var nombuser = $("#nomopeyaci").val().toUpperCase(); alert(nombuser ); var datastring = "nombreproyaci="+nombuser +"&_token="+token; $.ajax({ type: "POST", data: datastring, url: "registrodyaciprovee", 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);
    }
}

}) }

jpmg left a reply on Problem In Request

My controller

public function saveusers(Request $request) { $nameuser = $request->input('nombreproyaci'); }

Sr. I think the problem is in the request, because i put an alert in my jquery and the alert prints ("Brothers&Suns")

jpmg left a reply on Problem In Request

My controller

public function saveusers(Request $request)

{ $nameuser = $request->input('nombreproyaci'); }

Sr. I think the problem is in the request, because i put an alert in my jquery and the alert prints (Brothers&Suns)

jpmg left a reply on Problem In Request

My controller

public function saveusers(Request $request)
{
        $nameuser =  $request->input('nombreproyaci');
}

Sr. I think the problem is in the request, because i put an alert in my jquery and the alert prints () Brothers&Suns

jpmg left a reply on Problem In Request

My controller public function saveusers(Request $request){ $nameuser = $request->input('nombreproyaci'); } Sr. I think the problem is in the request, because i put an alert in my jquery and the alert prints (Brothers&Suns)

jpmg started a new conversation Problem In Request

Hello forum... I have a problem in a request, I have a request that get names, the problem is if the name have "&" for example "Brothers&Suns" it get only Brothers... and i need all!! I use in headers UTF8... I try with..

$request->input('name'); utf8_encode($request->input('name'));

I keep getting only the string befor the "&"... Can some help me..! Thanks Sorry for my English

16 Nov
8 months ago

jpmg left a reply on Problem Using Modal And FullCalendar

thank you is working but.. when the user click in the first time the calendar show, but if clicked again the second modal view is show empty.. please help!

this is how I call the second modal view..

function controlcronograma(){ var datastring = ""; $.ajax({ type: "POST", url: "gestion/cronogramaactividad", data: datastring, success: function(data){ $(data).appendTo('body').modal('show');

 }

})

}

my second modal view.

$( window ).ready(function(){

$(document).on('hidden.bs.modal', function (e) { if ($(e.target).attr('data-refresh') == 'true') { // Remove modal data $(e.target).removeData('bs.modal'); // Empty the HTML of modal $(e.target).html(''); } });

});

/* DO NOT REMOVE : GLOBAL FUNCTIONS! * * pageSetUp(); WILL CALL THE FOLLOWING FUNCTIONS * * // activate tooltips * $("[rel=tooltip]").tooltip(); * * // activate popovers * $("[rel=popover]").popover(); * * // activate popovers with hover states * $("[rel=popover-hover]").popover({ trigger: "hover" }); * * // activate inline charts * runAllCharts(); * * // setup widgets * setup_widgets_desktop(); * * // run form elements * runAllForms(); * ******************************** * * pageSetUp() is needed whenever you load a page. * It initializes and checks for all basic elements of the page * and makes rendering easier. * */
pageSetUp();

/*
 * ALL PAGE RELATED SCRIPTS CAN GO BELOW HERE
 * eg alert("my home function");
 *
 * var pagefunction = function() {
 *   ...
 * }
 * loadScript("js/plugin/_PLUGIN_NAME_.js", pagefunction);
 *
 * TO LOAD A SCRIPT:
 * var pagefunction = function (){
 *  loadScript(".../plugin.js", run_after_loaded);
 * }
 *
 * OR
 *
 * loadScript(".../plugin.js", run_after_loaded);
 */

// PAGE RELATED SCRIPTS

// pagefunction

var fullviewcalendar;

var pagefunction = function() {

    // full calendar

    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();

    var hdr = {
        left: 'title',
        center: 'month,agendaWeek,agendaDay',
        right: 'prev,today,next'
    };

    var initDrag = function (e) {
        // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/)
        // it doesn't need to have a start or end

        var eventObject = {
            title: $.trim(e.children().text()), // use the element's text as the event title
            description: $.trim(e.children('span').attr('data-description')),
            icon: $.trim(e.children('span').attr('data-icon')),
            className: $.trim(e.children('span').attr('class')) // use the element's children as the event class
        };
        // store the Event Object in the DOM element so we can get to it later
        e.data('eventObject', eventObject);

        // make the event draggable using jQuery UI
        e.draggable({
            zIndex: 999,
            revert: true, // will cause the event to go back to its
            revertDuration: 0 //  original position after the drag
        });
    };

    var addEvent = function (title, priority, description, icon) {
        title = title.length === 0 ? "Untitled Event" : title;
        description = description.length === 0 ? "No Description" : description;
        icon = icon.length === 0 ? " " : icon;
        priority = priority.length === 0 ? "label label-default" : priority;

        var html = $('<li><span class="' + priority + '" data-description="' + description + '" data-icon="' +
            icon + '">' + title + '</span></li>').prependTo('ul#external-events').hide().fadeIn();

        $("#event-container").effect("highlight", 800);

        initDrag(html);
    };

    /* initialize the external events
     -----------------------------------------------------------------*/

    $('#external-events > li').each(function () {
        initDrag($(this));
    });

    $('#add-event').click(function () {
        var title = $('#title').val(),
            priority = $('input:radio[name=priority]:checked').val(),
            description = $('#description').val(),
            icon = $('input:radio[name=iconselect]:checked').val();

        addEvent(title, priority, description, icon);
    });

    /* initialize the calendar
     -----------------------------------------------------------------*/

    fullviewcalendar = $('#calendar').fullCalendar({

        header: hdr,
        buttonText: {
            prev: '<i class="fa fa-chevron-left"></i>',
            next: '<i class="fa fa-chevron-right"></i>'
        },

        editable: true,
        droppable: true, // this allows things to be dropped onto the calendar !!!

        drop: function (date, allDay) { // this function is called when something is dropped

            // retrieve the dropped element's stored Event Object
            var originalEventObject = $(this).data('eventObject');

            // we need to copy it, so that multiple events don't have a reference to the same object
            var copiedEventObject = $.extend({}, originalEventObject);

            // assign it the date that was reported
            copiedEventObject.start = date;
            copiedEventObject.allDay = allDay;

            // render the event on the calendar
            // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
            $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

            // is the "remove after drop" checkbox checked?
            if ($('#drop-remove').is(':checked')) {
                // if so, remove the element from the "Draggable Events" list
                $(this).remove();
            }

        },

        select: function (start, end, allDay) {
            var title = prompt('Event Title:');
            if (title) {
                calendar.fullCalendar('renderEvent', {
                        title: title,
                        start: start,
                        end: end,
                        allDay: allDay
                    }, true // make the event "stick"
                );
            }
            calendar.fullCalendar('unselect');
        },

        events: [{
            title: 'All Day Event',
            start: new Date(y, m, 1),
            description: 'long description',
            className: ["event", "bg-color-greenLight"],
            icon: 'fa-check'
        }, {
            title: 'Long Event',
            start: new Date(y, m, d - 5),
            end: new Date(y, m, d - 2),
            className: ["event", "bg-color-red"],
            icon: 'fa-lock'
        }, {
            id: 999,
            title: 'Repeating Event',
            start: new Date(y, m, d - 3, 16, 0),
            allDay: false,
            className: ["event", "bg-color-blue"],
            icon: 'fa-clock-o'
        }, {
            id: 999,
            title: 'Repeating Event',
            start: new Date(y, m, d + 4, 16, 0),
            allDay: false,
            className: ["event", "bg-color-blue"],
            icon: 'fa-clock-o'
        }, {
            title: 'Meeting',
            start: new Date(y, m, d, 10, 30),
            allDay: false,
            className: ["event", "bg-color-darken"]
        }, {
            title: 'Lunch',
            start: new Date(y, m, d, 12, 0),
            end: new Date(y, m, d, 14, 0),
            allDay: false,
            className: ["event", "bg-color-darken"]
        }, {
            title: 'Birthday Party',
            start: new Date(y, m, d + 1, 19, 0),
            end: new Date(y, m, d + 1, 22, 30),
            allDay: false,
            className: ["event", "bg-color-darken"]
        }, {
            title: 'Smartadmin Open Day',
            start: new Date(y, m, 28),
            end: new Date(y, m, 29),
            className: ["event", "bg-color-darken"]
        }],

        eventRender: function (event, element, icon) {
            if (!event.description == "") {
                element.find('.fc-event-title').append("<br/><span class='ultra-light'>" + event.description +
                    "</span>");
            }
            if (!event.icon == "") {
                element.find('.fc-event-title').append("<i class='air air-top-right fa " + event.icon +
                    " '></i>");
            }
        },

        windowResize: function (event, ui) {
            $('#calendar').fullCalendar('render');
        }

    });

    /* hide default buttons */
    $('.fc-header-right, .fc-header-center').hide();



    $('#calendar-buttons #btn-prev').click(function () {
        $('.fc-button-prev').click();
        return false;
    });

    $('#calendar-buttons #btn-next').click(function () {
        $('.fc-button-next').click();
        return false;
    });

    $('#calendar-buttons #btn-today').click(function () {
        $('.fc-button-today').click();
        return false;
    });

    $('#mt').click(function () {
        $('#calendar').fullCalendar('changeView', 'month');
    });

    $('#ag').click(function () {
        $('#calendar').fullCalendar('changeView', 'agendaWeek');
    });

    $('#td').click(function () {
        $('#calendar').fullCalendar('changeView', 'agendaDay');
    });

};

// end pagefunction

// destroy generated instances

// destroy generated instances
// pagedestroy is called automatically before loading a new page
// only usable in AJAX version!

var pagedestroy = function(){

    /*
    Example below:

    $("#calednar").fullCalendar( 'destroy' );
    if (debugState){
        root.console.log("✔ Calendar destroyed");
    }

    For common instances, such as Jarviswidgets, Google maps, and Datatables, are automatically destroyed through the app.js loadURL mechanic

    */

    fullviewcalendar.fullCalendar( 'destroy' );
    fullviewcalendar = null;
    $("#add-event").off();
    $("#add-event").remove();

    $('#external-events > li').off();
    $('#external-events > li').remove();
    $('#add-event').off();
    $('#add-event').remove();
    $('#calendar-buttons #btn-prev').off();
    $('#calendar-buttons #btn-prev').remove();
    $('#calendar-buttons #btn-next').off();
    $('#calendar-buttons #btn-next').remove();
    $('#calendar-buttons #btn-today').off();
    $('#calendar-buttons #btn-today').remove();
    $('#mt').off();
    $('#mt').remove();
    $('#ag').off();
    $('#ag').remove();
    $('#td').off();
    $('#td').remove();

    if (debugState){
        root.console.log("✔ Calendar destroyed");
    }
}

// end destroy

// loadscript and run pagefunction
loadScript("js/plugin/moment/moment.min.js", function(){
    loadScript("js/plugin/fullcalendar/jquery.fullcalendar.min.js", pagefunction);
});
×

Modal header

    </div>

</div>
<div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
</div>
14 Nov
8 months ago

jpmg started a new conversation Problem Using Modal And FullCalendar

Hi i have a problem using problem using modal and fullCalendar in a second modal view!! In my first modal window i have a button to a second modal view, inside the second view i want to show a calendar so i user can see free days for appointment with the doctor. in my first modal view i have this.

Cronograma
                                              <button type="button"  class="btn btn-success btn-circle" onclick="controlcronograma()" data-toggle="modal" data-target="#doc-cal"><i class="fa fa-calendar"></i></button>
                                            </div>

in my .js

function controlcronograma(){ var fechaini = $( "#feini" ).val(); var eltoken = $("#token").val(); var datastring = "feini="+fechaini+"&_token="+eltoken; $("#doctor-calendar").fullCalendar({

 defaultDate: '2018-03-12',
 editable: true,
 eventLimit: true, // allow "more" link when too many events
 events: [
   {
     title: 'All Day Event',
     start: '2018-03-01'
   },
  
 ]

});

$('#doc-cal').on('shown.bs.modal', function () { $("#doctor-calendar").fullCalendar('render'); }); $.ajax({ type: "POST", url: "gestion/cronograma", data: datastring, headers: { "X-CSRF-TOKEN": eltoken }, success: function(data){

   $(data).appendTo('body').modal();

 }

})

} in my second modal view..

<!-- Modal content-->
<div class="modal-content">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&times;</button>
    <h4 class="modal-title">Cronograma de Actividade</h4>
  </div>

  <div class="modal-body">
    <div class="doctor-detail-wrap">
      <div id="doctor-calendar"></div>
    </div>
  </div>
  <div class="modal-footer">
    <!-- <input type="submit" class="btn btn-warning" id="doc-update" value="Update"> -->
    <button type="button" class="btn btn-default" id="plist-close" data-dismiss="modal">Close</button>
  </div>
</div>

the problem the i have is when the user click in the button in the first time doesn't show anything, but if clicked again it show 2 modals window one modal window with the calendar, and another empty modal view...

so i what to appear one window modal with the callendar... please help???

25 Oct
8 months ago

jpmg started a new conversation Problem With A Modal View

Hi i have a problem with a modal view, the thing is the it work all right, the problem is if i put any script in my modal view it works, but when i close the view all my scripts line print in the body of my panel, and like i say it works bout i don't whant the when the user close the view the scripts lineas print in the body of my panel..

modal lis.blade.php

Listado de Materiales (Nro. de Pedido {{ $nmobra }}) # Codigo Producto Cantidad Und. Med Opción @foreach( $losmater as $losmater )
                           <tr >
                               <td width="4%"><?php echo $i?></td>
                               <td width="12%">{{ $losmater->codigo }}</td>
                               <td width="37%">{{ $losmater->nombre }}</td>
                               <td width="4%">{{ $losmater->cantidad }}</td>
                               <td width="8%">{{ $losmater->medida }}</td>
                               <th width="5%" class="text-center"><i class="fa fa-check"></i></th>
                           </tr>
                              <?php
                              $i++;?>
                              @endforeach
                          <?php  }
                              ?>
                    </tbody>
                </table>
            </div>

     
    </div>
    <!-- /.panel-body -->
</div>
<!-- /.panel -->
alert('d')

when the user close the modal view "alert('d')" print in the body of my panel, but I need to put some scripts N line and I don't want the appear in the body of my panel!!! Please Help!!! Sorry for my english

06 Oct
9 months ago

jpmg left a reply on Problem Saving Data Using Laravel And Ajax

Still not working...

I have a layouts. app.blade.php

<script type="text/javascript" src="/js/sb-admin-2.js"></script>
<script type="text/javascript" src="/js/morris.min.js"></script>
<script type="text/javascript" src="/js/paginas.js"></script>
<script type="text/javascript">
$.ajaxSetup({
  headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  }
});
</script>

     @yield('content')

I call all my function is the right?

My blade for my app.blade is:

departamento.blade.php

Registro de Departamento
              <input type="hidden" id="token" value="{{ csrf_token() }}">
              <input type="hidden" id="user_id" value="{{ Auth::user()->id }}">
                <div class="form-group">
                    <label>Nombre departamento</label>
                    <input class="form-control" id='nbdepartamento'>
                </div>
                <button type="submit" class="btn btn-primary" onclick="GuardDepartamento()">Guardar</button>
        </div>

    </div>
    <!-- /.row (nested) -->
</div>
<!-- /.panel-body -->
<div class="panel-heading">
    Departamentos Registrados
</div>

my function in java is: function GuardDepartamento(){ var nbdepartamento = $("#nbdepartamento").val(); var user_id = $("#user_id").val(); var token = $("#token").val(); var datastring = "nbdepartamento="+nbdepartamento+"&user_id="+user_id; $.ajax({ type: "POST", data: datastring, url: "store", success: function(data){ console.log(data); }

}) }

My route is: web.php Auth::routes();

Route::get('/home', '[email protected]')->name('home'); Route::get('/', 'Auth\[email protected]')->name('logout'); Route::post('usuarios/registro', '[email protected]')->name('registro'); Route::post('usuarios/departamento', '[email protected]')->name('departamento'); Route::post('store', '[email protected]')->name('store');

My Controller is:

jpmg started a new conversation Problem Saving Data Using Laravel And Ajax

Hi everybody!! I have problem saving data in my laravel project i new so sorry for my question.. In my departamento.blade.php I have this code.

              <input type="hidden" id="token" value="{{ csrf_token() }}">
              <input type="hidden" id="user_id" value="{{ Auth::user()->id }}">
                <div class="form-group">
                    <label>Nombre departamento</label>
                    <input class="form-control" id='nbdepartamento'>
                </div>
                <button type="submit" class="btn btn-primary" onclick="GuardDepartamento()">Guardar</button>
        </div>
    
    </div>
    <!-- /.row (nested) -->
</div>

In my javascript function

var nbdepartamento = $("#nbdepartamento").val(); var user_id = $("#user_id").val(); var token = $("#token").val(); var datastring = "nbdepartamento="+nbdepartamento+"&user_id="+user_id; $.ajax({ type: "POST", data: datastring, url: "store", success: function(data){ console.log(data); }

})

in my route. Auth::routes();

Route::get('/home', '[email protected]')->name('home'); Route::get('/', 'Auth\[email protected]')->name('logout'); Route::post('usuarios/registro', '[email protected]')->name('registro'); Route::post('usuarios/departamento', '[email protected]')->name('departamento'); Route::post('store', '[email protected]')->name('store'); //Route::resource('departamentos', 'Departamento');

in my [email protected]

public function store(Request $request) {

     $departamento = new Departamento;
     $departamento->nbdepartamento = $request->nbdepartamento;
     $departamento.save();

    print $request->nbdepartamento;

}

The problem that i get is POST http://127.0.0.1:8000/store 500 (Internal Server Error) Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message So I can't save my new department, Why????????????????

Please can someone help me, sorry for my english!! Thank You