massum

Experience

320

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 0 Lessons Completed
  • 0 Favorites

5th August, 2016

massum started a new conversation Required_with In Laravel For Input Filed As Array • 1 year ago

i have a table with checkbox as array and textbox as also array. what i want to achieve is when the user checked a checkbox it should validate that input textbox should not be empty.

public function roombooking(Request $request)
    {


      $messsages = array(
        'check.required'=>'No room was selected.Please select room to proceed for booking !',
        'txtnos.required|numeric'=>'Please enter no of persons',
    );
      $rules = array(
        'check'=>'required',
        'txtnos'=>'required_with:data', //txtnos is a array input filed  and data is a array checkbox 
        );
      $validator = Validator::make($request->all(),  $rules,$messsages
            );
      if ($validator->fails()) {

            return Redirect::back()
                ->withErrors($validator)
                ->withinput();
                
        }
}

27th July, 2016

massum started a new conversation Payumoney Using Softon Indipay • 1 year ago

please help me on the following things as i am not sure how to go about it

  1. surl->how to pass the surl when setting the parameters.
  2. In the github documentation it says to add the response code in the redirect url. Please help me on how to set the redirect url and where to write the response code
  3. github documentation says 'Also add the response route to the remove_csrf_check config item to remove CSRF check on these routes. ' Please help me on where to change it

25th June, 2016

massum started a new conversation How To Access Multiple Result Of Mysql Stored Procedure? • 1 year ago

In my stored procedure I have two select statement. which when executed gives two results. how to access both the result in laravel below is my sql query. for eg i m using same select query two.

DELIMITER $$

USE `palaresort`$$

DROP PROCEDURE IF EXISTS `RoomAvailability`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `RoomAvailability`( IN CheckInDate VARCHAR(10),IN CheckOutDate VARCHAR(10) )
BEGIN
    SELECT
    `roomid`
    , `roomname`
    , `Desc`
    , `price`
   
FROM
    `palaresort`.`t_rooms`;
    
    SELECT
    `roomid`
    , `roomname`
    , `Desc`
    , `price`
   
FROM
    `palaresort`.`t_rooms`;
    
    
       END$$

DELIMITER ;

here is my laravel model code

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use DB;

class roommaster extends Model
{
    protected $table = 'roommasters';

    public static function RoomAvailability($checkin,$checkout) {
        
        $roommaster[] = DB::select('call RoomAvailability('. $checkin .','. $checkout .')')->fetchall();
        //$roommaster = DB::select('select * from roommasters');
        
        
        dd($roommaster);
        
    }
}

23rd June, 2016

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

when i run the code as u sugested i get the link in the console "XHR finished loading: GET "http://localhost:8000/roombooking?id=2". but its not redirecting to that page. Kindly suggest me on how to achieve that i m really stuck in here and can't proceed further @Khudadad

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

what i mean is i want to take the value of one page and send it to another page. As i m new to laravel so i don't know how to go about it. So far i am able to get the data of the view to the controller. but from the controller how to return to another view is what i am not clear about.

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

but here is the thing, i have written the ajax in the view name 'booking' and i want to display the fetched data from ajax in roombooking. currently the data is getting return to the booking view. not in roombooking page.

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

now i am able to view the data in the console but its not redirecting to that page. do i need to change. @tomo_pongrac and @Khudadad

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

still error. in the alert it say object Object. and in the console it shows ''http://localhost:8000/roombooking?id=1 500 (Internal Server Error) @Khudadad

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

in the console the error is showing ''http://localhost:8000/roombooking?id=1 500 (Internal Server Error)

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

$.ajax({
          url: 'roombooking',
          type: "get",
          data: {id:data},
           success: function(response){ // What to do if we succeed
               $data = $(response);
              console.log($data); 
              },
            error: function(response){
                alert('Error'+response);
                }
            });
            
    });
it show the value in the console. however if i try to return a view it gives error

return view ('partials.roombooking', compact('data')->render() ;

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

this is the controller file

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Input;
use App\roommaster;
use DB;
class pagescontroller extends Controller
{
    public function index()
    {
        return view('pages.index');
    }

    public function about()
    {
        return view('pages.about');
    }

    public function room()
    {
        return view('pages.room');
    }
    public function contact()
    {
        return view ('pages.contact');
    }
    public function booking()
    {
        return view ('pages.booking');
             
    }
    public function gallery()
    {
        return view ('pages.gallery');
    }

    public function listofroom(Request $request)
    {
      //$roommasters=roommaster::all();
      
       $checkin = $request->checkin;
       $checkout = $request->checkout;
       $roommaster = roommaster::RoomAvailability($checkin,$checkout);
      //dd($roommaster->toJson());
      return view ('pages.booking')->with('roomname',$roommaster);
    
    }

    public function roombooking(request $request)
    {
     //redirect('pages.roombooking');
     //return 'success';
      $data= $request->dataval;
      return $data;
     // return view ('pages.roombooking') ;
      //return View::make('pages.roombooking')-with(compact('success'));
      //return view('pages.roombooking');

    }
    public function SelectedTableId(Request $request)
    {
     
     return view ('pages.roombooking');
      // return array('name' => $name);
         
    }
    
   
}

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

this the route file

Route::get('/', '[email protected]'); 
Route::get('about','[email protected]');
Route::get('room','[email protected]');
Route::get('contact','[email protected]');
Route::get('booking','[email protected]');
Route::POST('booking','[email protected]');
Route::get('gallery','[email protected]');

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

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

yes. let me share you the entire details. the name of the view is booking where i have written the script.

    var checkedRows = [];
    var data=[] ;
    $(function () {
        $('#table').on('check.bs.table', function (e, row) 
          {
     
            checkedRows.push({id: row.roomid});
            console.log(checkedRows);
           
          });
        $('table').on('uncheck.bs.table', function (e, row) {
            $.each(checkedRows, function(index, value) {
            if (value.id === row.roomid) {
              checkedRows.splice(index,1);
            }
          });
          console.log(checkedRows);
          });

        $("#add_cart").click(function() 
        {
          
          $("#output").empty();
          data="";
          $.each(checkedRows, function(index, value) {
            data+=  value.id ;
          // $('#output').append($('<li></li>').text(value.id ));
            
        });
           
          $.ajax({
              url: 'roombooking',
              type: "get",
              data: {id:data},
               success: function(response){ // What to do if we succeed
              if(data == "success")
            alert(response); 
        }
            });
            
    });
      });

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

i tried your answer but it gives error 'http://localhost:8000/roombooking?id=12 405 (Method Not Allowed)' what i m doing is i have a view name booking. in that booking page i am using the ajax and sending the data to roombooking view . @Khudadad

massum left a reply on Pass Data From Ajax To Controller In Laravel • 1 year ago

can i send the $data to another view... return view ('booking')->('data',$data)

massum started a new conversation Pass Data From Ajax To Controller In Laravel • 1 year ago

i am having a problem in sending ajax get request to fetch the data in to the controller. i am sharing my code below plz help javascript $.ajax({ url: 'roombooking', type: "get", data: {id:data}, success: function(response){ // What to do if we succeed if(data == "success") alert(response); } }); route file Route::post('roombooking','[email protected]'); controller file public function roombooking(request $request) { //redirect('pages.roombooking'); //return 'success'; $data= $request->dataval; return $data; // return view ('pages.roombooking') ; //return View::make('pages.roombooking')-with(compact('success')); //return view('pages.roombooking');

}

what i am trying to achieve is the data i am sending through ajax i should be able to access those data and send it to another view

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.