Roshanay

Experience

900

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

15th November, 2017

Roshanay left a reply on Sending Php Data Through Html Form To Jquery • 1 week ago

So what's the solution?

Roshanay started a new conversation Sending Php Data Through Html Form To Jquery • 1 week ago

I am developing a system in which when the user places the order and it gets delivered, user gets the option of rating the item on the homepaage.

One order has multiple options. When the items are rated, in the backend, the status of the order is changed from delivered to rated, so that the user doesn't keep seeing it on their homepage.

Following is the html code.

@foreach($itemsArray as $order)
    <div id="orderArea">
    @while($count<1)
    {{$order['status']}} {{$order['id']}} {{$order['total']}}<br>
       <?php  $count++; ?>
    @endwhile
        <?php
        ?>

    Item: {{$order['name']}}
    <form>
       Rate: <input name="rate" id="rate" Orderid="{{$order['id']}}" ><br>
       Comment: <input name="comment" Itemid="{{$order['itemId']}}" id="comment"><br>
        <input name="submit" type="submit" value="submit" id="{{$submit}}" itemidd="{{$order['itemId']}}">
        <?php $submit++; ?>
    </form>
    <br>
</div>
@endforeach

Following is the jquery code.

$(function () {

        $('form').on('submit', function (e) {
            var rate = $('#rate').val();
            var comment = $('#comment').val();
            var itemId = $('#submit').attr('itemidd');
            //var itemId = $(this).attr('itemidd');
            var Orderid = $('#rate').attr('Orderid');
            alert(itemId);
            e.preventDefault();

            $.ajax({
                type: "post",
                url:  "{{route('storeRating')}}",
                data:
                    {
                        rate: rate,
                        comment: comment,
                        itemId: itemId,
                        Orderid: Orderid
                    },

                success: function (result) {
                    console.log(result);

In this code, the order id and total are showed. Then the items are showed with the option of user to rate. When the user clicks the submit button, only the value of the first item is being given. if the user clicks on the submit button on any item, the function reads the id of the first item of every order.

Please Help.

14th November, 2017

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

Got it, thanks. My website is not on the internet right now. I'll buy a domain name soon and put the website up and then will be able to the rest. Right?

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

Still the same.

I don't understand the following line: Fill in the ID and Secret pairs with what you see on your Facebook App dashboard.

Please explain this.

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

https://www.facebook.com/v2.10/dialog/oauth?client_id=your-facebook-app-id&redirect_uri=http%3A%2F%2Fchefonline.dev&scope=email&response_type=code&state=9SFR5ftefhbKWoHLzuRfODD2mqifp4u5ShacDIwK&sw_fnr_id=2321304462&fnr_t=2

This is the link. I haven't created the app. I just created the front end login dialog box and pressed submit. This is where it's redirecting to.

Roshanay started a new conversation Help With Laravel Eloquent • 1 week ago

Hi, I want to get the order records which either have the status of delivered or rated. I am writing the following code:

$orders = order::where('id', $orderItem->id)
                ->where('status',  'delivered'||'status',  'rated')

But this doesn't show the result.

If I use

$orders = order::where('id', $orderItem->id)
                ->orWhere('status',  'delivered'||'status',  'rated')

Even then it doesn't show the correct result. Please help.

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

There is nothing being displayed iin that file.

13th November, 2017

Roshanay started a new conversation Socialite Github Package • 1 week ago

I used Socialite package by Github, for login with facebook option in my system.

It goes to facebook for user details, however, I don't think the callback is coming in. When I click login, it goes to facebook and it says: Sorry, something went wrong.

We're working on getting this fixed as soon as we can.

The function in the login controller for callback is as follows

 public function handleProviderCallback()
    {
        $user = Socialite::driver('facebook')->user();
        var_dump($user);die();


        // OAuth Two Providers
        $token = $user->token;
        $refreshToken = $user->refreshToken; // not always provided
        $expiresIn = $user->expiresIn;

        // OAuth One Providers
        $token = $user->token;
        $tokenSecret = $user->tokenSecret;

        // All Providers
        $userid = $user->getId();
        $username = $user->getName();
        $useremail = $user->getEmail();

        $userrr = User::all();
        foreach ($userrr as $user) {

            if ($user->id == $userid) {
                return redirect()->action('Auth\[email protected]');
            }

                else {
                    $userr = new User();
                    $userr->name = $username;
                    $userr->id = $userid;
                    $userr->email = $useremail;
                    $userr->role = 1;
                    return view('user.profile')->with('user', $user);

                }
        }

        // $user->token;
    }
$userrr = User::all();

From this line, the code checks if the user is new or old. If the user is old, it redirects to home. If the user is new, it saves their details and then sends to another function, which redirects them.

However, this part of the code isn't even functional as of yet, because I think I am not getting the callback or response from facebook server. Please help.

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

Okay, so I made the front end. The request is being sent to facebook. But when it is redirected, it says : Sorry, something went wrong.

We're working on getting this fixed as soon as we can.

Following is the function in the login controller.

 public function handleProviderCallback()
    {
        $user = Socialite::driver('facebook')->user();


        // OAuth Two Providers
        $token = $user->token;
        $refreshToken = $user->refreshToken; // not always provided
        $expiresIn = $user->expiresIn;

        // OAuth One Providers
        $token = $user->token;
        $tokenSecret = $user->tokenSecret;

        // All Providers
        $user->getId();
        $user->getNickname();
        $user->getName();
        $user->getEmail();
        $user->getAvatar();

        // $user->token;
    }

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

Also, how do I link it with my frontend? Sorry for so many questions. They might seem immature. But I am doing something like this for the first time and need help.

Roshanay left a reply on Help With Socialite, Github Package • 1 week ago

public function handleProviderCallback($service)
    {
        $provider = Socialite::driver($service);

        $socialiteUser = $provider->stateless()->user();

        dd($socialiteUser);
    }

where do I place this function?

Also, instead of service, I write facebook, right? Because I want login from facebook option.

12th November, 2017

Roshanay started a new conversation Help With Socialite, Github Package • 1 week ago

I am developing a website in which I want to give the user an option to login with facebook. For that, I am trying Socialite package by GitHub.

I am taking commands from this website. https://github.com/laravel/socialite

I have done everything till config/app.php file.

Further, I don't know what to do about the following. 'github' => [ 'client_id' => 'your-github-app-id', 'client_secret' => 'your-github-app-secret', 'redirect' => 'http://your-callback-url', ],

In config/services.php file, I have written the following: 'facebook' => [ 'client_id' => 'your-facebook-app-id', 'client_secret' => 'your-facebook-app-secret', 'redirect' => 'http://chefonline.dev', ], But I think this isn't correct.

Further, I have added the functions they asked to make in login controller file. But, after that, I don't know is meant by the following:

  1. scopes
  2. return Socialite::driver('google') ->with(['hd' => 'example.com'])->redirect();
  3. Stateless Authentication code, return Socialite::driver('google')->stateless()->user(); , where do I place this?
  4. I don't know where to place the code written in Retrieving User Details and Retrieving User Details From Token

PLEASE HELP.

31st October, 2017

Roshanay started a new conversation Displaying Data In JavaScript • 3 weeks ago

I am sending an ID using javascript to backend server. The ID is matched with the table records and the correct data is sent back by the php function to the javascript function which then displays the result. The ID is correctly being sent and the correct answer is being sent to the front end. But, I don't know how to display the data. Following is the function of php.

In this function, the information is being stored in an array. The name, price and chef. This information has to be displayed. I am sending it in json form.

public function showorderdetail(Request $request)
    {
        Log::info("id".$request->orderId);
        $itemsArray = [];
        $orderId = $request->orderId;
        $order = order::where('id', $orderId)->first();
        $itemId = orderitem::where('order_id', $order->id)->get();
        foreach ($itemId as $itemIds)
        {
            $items = item::where('id', $itemIds->item_id)->get();

            foreach ($items as $item)
            {
                $itemsArray[] = [
                    'name' => $item->name,
                    'price' => $item->price,
                    'chef' => $item->chef_id,
                ];
            }

        }
        return json_encode($itemsArray);
    }

Following is the javascript function. In the success part, the data has to be displayed. I don't know the function that should be used or how it is going to be used.

$('.viewOrderDetail').click(function () {
        var orderId = $(this).attr('orderId');
        console.log(orderId);
    $.ajax({
        type: "get",
        url: "{{route('showorderdetail')}}",
        data: {
        orderId: $(this).attr("orderId")
        },
        cache: false,
        success: function (result) {
            console.log(result)
       
            $('#detail').html("<p>" + name + " " + " "+ price +  "</p>");
        }
    });
    });


Please help.

24th October, 2017

Roshanay started a new conversation Jagvascript Function Call In Html • 1 month ago

I am making a cart. The users are able to view the cart through javascript. When a user enters the quantity, and licks on add. Javascript function is called which adds the product in the array and shows the cart. In the success function, I am displaying the cart with the relevant details of the product. I also have to give the option of removing a specific product. So when the user clicks on remove, the data is sent to be deleted. Following is the code snippet for that.

''' success: function (result) { $('#ViewCart').html(""); $.each(result, function (key, val) { $('#ViewCart').append("

" + " " + val.id + " " + val.name + " " + val.qty + "<button class="remove" >Remove" +"

"); });

        }

'''

I have made the remove function like this ''' $('.remove').click(function () { alert('coming here'); }); ''' This is just to check if the function is working on not. As it turns out, it is not working because the alert doesn't pop up. Can someone please tell me the fault?

17th October, 2017

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

Okay! Otherwise, I shall be waiting for you. Thanks.

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

  1. {{$items->name}} shows that id is being brought too. For showing id, I just have to write {{$items->id}}. But I don't know where should I write it to be sent along with the quantity. That's also where I need a little help.
  2. Yes, what I want is that user will click add on every item they want, then click another button, which will send the item ids and their quantities to the server. However, I haven't made that button yet, because I wanted the values to be read properly first. Should I make that right now?
  3. What was happening earlier was, when I clicked on Add to Cart, only the first product was showing the input field. That's because every time any other Add to Cart button was clicked, the id was same. So, I initialized these variables and at the end of foreach loop, I add 1 to each, like: This way, the ids are unique. Do you understand?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

@foreach($item as $items)
    {{$items->name}}
    
    div id="{{ $quantityy }}" style="display: none;">
            <label for="quantity" >Quantity</label>
            {{--// use classname instead of id. ID needs to be unique (one per page)--}}
            <input type="number" class="quantityid" name="quantity">
            <button class="addd" divAdd="{{$addd}}">Add!</button>
        </div>
@endforeach 

All the products will be displayed. They will have an option of Add to Cart. User clicks, an input field for quantity is opened. When user clicks on Add, the ajax function is called. User can add many products by clicking on add to cart.

I want to send the ids of each item along with their quantity to the backend server. Above, I have written the html/blade.

Below, is the function that I initially wrote and you changed for debugging purposes.

 $('.addd').click(function () {

        var mydata;


        $('input[name="quantity"]').each(function(){
            mydata = $(this).val();
           // window.alert(mydata);
        });

        $.ajax({

            type: "get",
            url: "{{route('add')}}",
            data: mydata,
           //data: {quantity: $('#quantityid').val()},
            cache: false,
            success: function (quantity) {
                console.log(quantity);
            }
        });
    });

Clear now?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

Sorry, I will tell you. Wait

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

I'll tell you, but first can you tell if at the end backend, the server is receiving one quantity multiple times or just once?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

When the values are sent to the server, with your code, a value of one row is sent one time or repeatedly? I want all values to be sent just once, with the product id.

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

Using your function and html, the values are fine. Like each time I click on add on different input fields, the values are fine, however, they are being repeated.

Like for example, if I add 1 in the first row and 3 in the second. When I click on 3rd row and write 5, then all 1, 3, and 5 are added again. Do you understand?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

$('.addd').click(function () {

        var mydata;


        $('input[name="quantity"]').each(function(){
            mydata = $(this).val();
           // window.alert(mydata);
        });

        $.ajax({

            type: "get",
            url: "{{route('add')}}",
            data: mydata,
           //data: {quantity: $('#quantityid').val()},
            cache: false,
            success: function (quantity) {
                console.log(quantity);
            }
        });
    });

This?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

$('.addd').click(function(e) {
    e.preventDefault();  // prevent normal click function

    // get the quantity value for each input
    $('.quantityid').each(function(e) {
        console.log($(this).val();
    });
});

should I replace my function with this?

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

$('.addd').click(function () {

       $('input[name="quantity"]').each(function(){
           var mydata = $(this).val();
       });

       $.ajax({

           type: "get",
           url: "{{route('add')}}",
           data: mydata,
           cache: false,
           success: function (quantity) {
               console.log(quantity);
           }
       });
   });

Still same error of mydata being undefined.

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

            <label for="quantity" >Quantity</label>
            <input type="number" id="quantityid" name="quantity">
            <button class="addd" divAdd="{{$addd}}">Add!</button>
        </div> ``` 

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

I don't know what the issue is but the html code is not displaying.

In the first div, there's id="{{ $quantityy }}" then the input has id="quantityid" and name="quantity" and then submit button has class="addd" (the function call) and divAdd="{{$addd}}

Roshanay left a reply on Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

Quantity Add!

html code

Roshanay started a new conversation Sending Multiple Values Of Same Input Field Via Ajax. • 1 month ago

The products are displayed. And there is an option of adding to the cart. When the user clicks on the button, it displays the quantity window. The user types the quantity and clicks on edit button. The issue previously was that only the data of first input field was going. So I changed the code and made the following ajax call:

$('.addd').click(function () {

    $('quantity').each(function(){
        var mydata = $(this).val();
        window.alert(mydata);
    });

    $.ajax({

        type: "get",
        url: "{{route('add')}}",
        data: mydata,
        cache: false,
        success: function (quantity) {
            console.log(quantity);
        }
    });
});

Now, the issue is that console shows that mydata is undefined variable. I think I am not putting the issue is with ('quantity'). I guess the issue is with html. Following is the html. Please let me know how to resolve this issue.

Quantity Add!

16th October, 2017

Roshanay started a new conversation How To Send Ajax Request To The Server. • 1 month ago

I am making a system in which products are displayed and each one has the option of Adding to Cart. When the user clicks the button, an input field appears, where user types their quantity and then click on add. When the add button is clicked, Ajax call is sent through the following function:

$('.addd').click(function () { $.ajax({ type: "POST", url: "{{route('add')}}", data: {quantity: $('#quantityid').val}, cache: false, success: function (result) { alert("added") } }); });

#quantityid is the html which is as follows:

Quantity Add!

However, the console is giving the following error: POST http://chefonline.dev/add 419 (unknown status)

Please tell me what's the problem and what's the solution

23rd September, 2017

Roshanay started a new conversation Trying To Get Property Of Non-object Error Php Laravel • 2 months ago

I am making a function in the controller to register chef, a type of a user. The user can upload a picture as well. Following is the code for that.

{

    $chef = new chef();
    $chef->name = $request->name;
    $chef->company = $request->company;
    $chef->email = $request->email;
    $chef->password = $request->password;
    $chef->address = $request->address;
    $chef->number = $request->number;
    $file = Input::file('picture');
    $file -> move ('images', $file->getClientOriginalName());
    $chef->picture = $request->file('picture');
    echo '<img src"images/'. $file->getClientOriginalName(). '"/>"';


    $chef->save();
    return view("checkimage")->with('chef', $chef);
}

It's working perfectly fine till here. The next step is to display the users.

Following is the code for that blade.

@foreach($chef as $chefs) {{ $chefs->name }}

@endforeach

However, it's showing an error. Trying to get property of non-object. I have tried everything, but it's not being fixed. Please tell me a solution.

22nd September, 2017

Roshanay left a reply on Image Intervention Usage PHP Laravel 5.4 • 2 months ago

I have been trying, but couldn't get throuugh. Can you tell me how that's done?

Roshanay left a reply on Image Intervention Usage PHP Laravel 5.4 • 2 months ago

Yes I did. And again, they are giving foo.jpg example. This is a static example. I want a dynamic way.

Roshanay started a new conversation Image Intervention Usage PHP Laravel 5.4 • 2 months ago

I successfully installed image intervention package. But now I don't know how to use it. I googled and saw saw many videos. Everywhere, they give example of foo.jpg. But I want to upload dynamically, for every user. Moreover, in the examples, there is a specific controller for the image. But I tend to keep the picture uploading in the same controller as the user. Like for example, user registers, fills name, nnumber, uploads picture. How can that happen?

Roshanay left a reply on Image Intervention Package • 2 months ago

This video is not working for me, since I haven't paid for it. I googled and youtubed a lot. The issue is that there are examples of foo.jpg being shown everywhere. But I want to do it dynamically, so that every user can upload a picture. Moreover, in the examples, there is a specific controller for the image. But I tend to keep the picture uploading in the same controller as the user. Like for example, user registers, fills name, nnumber, uploads picture. How can that happen?

21st September, 2017

Roshanay left a reply on Image Intervention Package • 2 months ago

Can you also tell me, now that I have installed the package. Where do I upload the images?

Roshanay left a reply on Image Intervention Package • 2 months ago

Done. Thank you so much.

Roshanay left a reply on Image Intervention Package • 2 months ago

But it doesn't allow $. What to do then?

Roshanay started a new conversation Image Intervention Package • 2 months ago

I am trying to install image intervention package.

when I write $ php composer.phar require intervention/image, it say $ is not allowed. The only way it works is composer install. That works.

But when I update the composer.json file with "intervention/image": "dev-master", in require and then update composer file with the command composer install, it says nothing to update.

What's the issue? Also, there are multiple composer.json files. I write this in base-dir file.

Please help me.

Roshanay left a reply on Laravel 5 File(Image) Upload Example With Validation • 2 months ago

{!! form::file('image', array('class' => 'image')) !!}

There is an error in this line. Can someone tell me what does {!!form !!} do?

Roshanay left a reply on Auto Registration By Php Laravel • 2 months ago

Turns out, I hadn't done that. It works now. Thank you soooo much! :D

Roshanay left a reply on Auto Registration By Php Laravel • 2 months ago

Yes, I did on the user migration and on the register view

20th September, 2017

Roshanay started a new conversation Auto Registration By Php Laravel • 2 months ago

When a new projects is made, the registration process is self made, up and running. Laravel itself provides email, name and password options. But when I added name and address to it, the values aren't carries forward to the database and as a result, it shows error.

I added the name and address field to view and create function in RegisterController. But I don't understand why isn't it forwarded to the database. Can anyone tell me what other changes are required to make this work?

Edit Your Profile
Update

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