amitshrestha221

Web Developer at Peace Nepal DOT Com

Experience

6,770

2 Best Reply Awards

  • Member Since 10 Months Ago
  • 11 Lessons Completed
  • 0 Favorites

6th June, 2017

amitshrestha221 started a new conversation Urgent Solution Required, Paginate Giving Issue. • 3 weeks ago

Whenever I perform

Model::paginate(10); ,

my browser gets frozen.

The same query

Model::get();, the data displays normally..

Firefox gets frozen and I am compelled to restart the laptop, whereas chrome shows

 *RECURSION*
 *RECURSION*


```  and then gets frozen in some minutes.

Please suggest me some answers.

18th May, 2017

amitshrestha221 left a reply on Get Laravel 5 DD In Laravel 4 • 1 month ago

@shakti there exists a dd() method but its weirder than var_dump() :D

amitshrestha221 started a new conversation Get Laravel 5 DD In Laravel 4 • 1 month ago

Is there any chance by which I can get DD feature of Laravel 5 in Laravel 4.

21st April, 2017

amitshrestha221 left a reply on Blackist Mime • 2 months ago

@bobbybouwmann what if i wanter all mimes except exe?

amitshrestha221 started a new conversation Blackist Mime • 2 months ago

How do we blacklist certain file types in mime validation. eg: blacklist .exe file type.

6th April, 2017

amitshrestha221 started a new conversation Get Rows On The Basis Of Response_id • 2 months ago



id    response_id     name      ans
1             a1                 zz           test              
1             a1                 zz           test              
1             a1                 zz           test              
1             a2                 zz           test              
1             a2                 zz           test              
1             a2                 zz           test              


I want a1 values in one array and a2 values in another.. assuming there can be a3, a4 ...................

amitshrestha221 left a reply on Group By Returning Only One Column • 2 months ago



id    response_id     name      ans
1             a1                 zz           test              
1             a1                 zz           test              
1             a1                 zz           test              
1             a2                 zz           test              
1             a2                 zz           test              
1             a2                 zz           test              


I want a1 values in one array and a2 values in another.. assuming there can be a3, a4 ...................

amitshrestha221 started a new conversation Group By Returning Only One Column • 2 months ago

Database


FormResponses::where('form_id',$id)
                                ->select('form_id','question_id','response_id')
                                ->orderBy('response_id')
                                ->get()
                                ->toArray();



i have multiple records of same response_id, but the result is only one record of a id.

21st March, 2017

amitshrestha221 started a new conversation MYSQL Not Working In Shared Hosting.. • 3 months ago

I am working with Laravel 5.3 which required PHP 5.6.4. In my server there is only option for 5.6.3 or 7.0

When I select 5.6.3 using Multi PHP Manager in cpanel for the domain, mysql connection works and returns value when i wrote simple code for testing connection:


<?php

    $conn = mysqli_connect('localhost','amplesho_admin', '1#Ampleadmin', 'amplesho_ampleshop1') or die('Database Error');

    if($conn)
        echo "success";
    else
        echo "failed";

While selecting 5.6.3 it returns success. But when i select 7.0, it returns nothing. I'm on a shared hosting.

20th March, 2017

amitshrestha221 started a new conversation MYSQL Not Working In Shared Hosting.. • 3 months ago

I am working with Laravel 5.3 which required PHP 5.6.4. In my server there is only option for 5.6.3 or 7.0

When I select 5.6.3 using Multi PHP Manager in cpanel for the domain, mysql connection works and returns value when i wrote simple code for testing connection:


<?php

    $conn = mysqli_connect('localhost','amplesho_admin', '1#Ampleadmin', 'amplesho_ampleshop1') or die('Database Error');

    if($conn)
        echo "success";
    else
        echo "failed";

While selecting 5.6.3 it returns success. But when i select 7.0, it returns nothing. I'm on a shared hosting.

16th March, 2017

amitshrestha221 started a new conversation Get Form Value In Get Url • 3 months ago

I want something like take the [var] and send it in url as get parameter..



<form method="get" action="{{ route('test.testURL') }}">
    <input type="text" name="var" value="var">    
</form>


13th March, 2017

amitshrestha221 left a reply on Currency Conversion • 3 months ago

@ri7nz but currency conversion is only available in premium account.. I need something like convert a currency to USD from currencyCode

like NPR to USD

amitshrestha221 left a reply on Currency Conversion • 3 months ago

@ri7nz i think your site does it.

amitshrestha221 left a reply on Currency Conversion • 3 months ago

I wanted something like.. pass the country code and your price and convert it to USD My application renders price on the basis of country code..

amitshrestha221 left a reply on Currency Conversion • 3 months ago

fixer doesnt get response for Nepali Currency to USD .. :/

amitshrestha221 left a reply on Currency Conversion • 3 months ago

@ri7nz does it apply for any currency of any country?

amitshrestha221 started a new conversation Currency Conversion • 3 months ago

I want something like, convert a country's price to USD in current date's rate.

Is there any packages for it? Thanks in advance..

3rd March, 2017

amitshrestha221 left a reply on Laravel Mysql Driver • 3 months ago

but i have already completed my project in 5.3.. what should i do?

amitshrestha221 left a reply on Laravel Mysql Driver • 3 months ago

there is no php.ini in my ftp :( .. m sorry if m getting it wrong..

amitshrestha221 started a new conversation Laravel Mysql Driver • 3 months ago

Okay I have got two options in server : 5.6.3 or 7.0 I'm with laravel 5.3 which requires 5.6.4 minimum.. If i upload using 5.6.3, it wont be supported, and if I go with 7.0 the following error comes up :


QueryException in Connection.php line 770: could not find driver (SQL: select * from `ample_systemsettings` limit 1)


What should I do?

28th February, 2017

amitshrestha221 left a reply on URGENT Upgrade Mysql To 5.7 URGENT • 4 months ago

can i save the json field as Text? will there be any effect?

amitshrestha221 left a reply on URGENT Upgrade Mysql To 5.7 URGENT • 4 months ago

@tomi what should I do? I'm really tensed..

amitshrestha221 left a reply on URGENT Upgrade Mysql To 5.7 URGENT • 4 months ago

I have used json field for many important features in my project which is only available from mysql 5.7. What should I do?

amitshrestha221 started a new conversation Upgrade Mysql To 5.7 • 4 months ago

How to upgrade MySQL to 5.7 from cpanel?

22nd February, 2017

amitshrestha221 started a new conversation Row Deletes Only Once.. • 4 months ago

Row deletes only once using ajax request..



//view

@forelse($banners as $banner)
                                    <tr class="gradeU">
                                        <td>{{ $loop->iteration }}</td>
                                        <td style="text-align: center;"><img src="{{ asset('uploads/banners').'/'.$banner->banner_image }}" style="height:50px; wdth:300px;"></td>
                                        <td style="text-align: center"> {{ $banner->product_name->name }}</td>
                                        <td class="center hidden-phone">
                                            <a class="btn btn-primary btn-xs" href="{{ route('banners.editBanner',[$banner->id]) }}">Edit</a>
                                            <a href="javascript:void(0)" class="btn btn-danger btn-xs" id="delete"  data-id="{{ $banner->id }}">Delete</a>
                                        </td
>                                   </tr>
                                @empty
                                    <tr class="gradeU">
                                        <th>-</th>
                                        <th>-</th>
                                        <th>-</th>
                                        <th class="hidden-phone">-</th>
                                    </tr>
                                @endforelse

//script


<script>

    $(function(){
        $("#delete").click(function(){
            var id= $(this).data("id");
            var url = "{{ url('banners/delete') }}/"+id;
            var $tr = $(this).closest('tr')

            jQuery.ajax({
                type: "GET",
                url: url,
                datatype: "json",
                success: function(data){
                    var obj = jQuery.parseJSON(data);
                    if(obj.status=='success'){
                        $("#delete_message").html("<div class='alert alert-success fade in'><button type='button' class='close close-sm' data-dismiss='alert'><i class='fa fa-times'></i></button><strong>Success!</strong>"+ obj.value +"</div>");
                        $tr.find('td').fadeOut(1000,function(){ 
                            $tr.remove();                    
                        }); 
                    }else{
                        $("#delete_message").html("<div class='alert alert-danger fade in'><button type='button' class='close close-sm' data-dismiss='alert'><i class='fa fa-times'></i></button><strong>Warning!</strong>"+ obj.value +"</div>");
                    }
                }
            });
        });
    });

</script>


//controller
public function delete($id){
        if(Banners::where('id',$id)->delete())
            print_r(json_encode(['status' => 'success', 'value' =>'Banner has been successfully deleted.']));
        else
            print_r(json_encode(['status' => 'error', 'value' =>'Something went wrong.']));
    }


21st February, 2017

amitshrestha221 left a reply on Cart Not Accepting Options.. • 4 months ago

My bad it was not option.. its options..

amitshrestha221 started a new conversation Cart Not Accepting Options.. • 4 months ago


I'm using this package..

[https://github.com/Crinsane/LaravelShoppingcart]

if($size != ''){
            $option = ['size' => $size,
                            'color' => $color];
        }else{
            $option = ['size' => $color];
        }

Cart::add(['id' => $id, 'name' => $name,'qty' => $qty, 'price' => $price, 'option' => $option]);


and it is not accepting options.. options shows blank array..

20th February, 2017

amitshrestha221 left a reply on Insert Base64 Decoded Image In Database.. • 4 months ago


I got my solution:

$data=Input::get('cropped_img');
        $data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data));
        file_put_contents(public_path('uploads/banners')."/banner.png", $data);


amitshrestha221 started a new conversation Insert Base64 Decoded Image In Database.. • 4 months ago


public function addSubmit(){
        $img= base64_decode(Input::get('cropped_img'));
        dd($img);
        //Image::make($logo->getRealPath())->resize(160,80)->save($logo_path);

}


how to insert the image to database?

19th February, 2017

amitshrestha221 left a reply on No Redirect After Form Submission • 4 months ago

Doesn't the action needs to be binded inside [ {{ route(' ') }} ] or [ {{ url('') }} ] ??

amitshrestha221 left a reply on No Redirect After Form Submission • 4 months ago

is the form being submitted or not?

amitshrestha221 left a reply on Show/Hide Not Working.. • 4 months ago

@cviv Vendr 1 content doesn't load now..

amitshrestha221 left a reply on Show/Hide Not Working.. • 4 months ago

@bobbybouwmann no it didnt work brother, but isnt the calls the same thing?

amitshrestha221 started a new conversation Show/Hide Not Working.. • 4 months ago



on clicking this

        <div class="cd-item item champ vendor-card hovereffect col-md-3" id="vendor-1">
    </div>


this div is shown:


    <div class="vendor-content" id="vendor-1-content">

            <div class="clearfix port">
                <h2>XYZ</h2>
                <a class="close-content cd-img-replace closee" data-vendor="vendor-1-content">
            <i id="vendor-1-close" class="fa fa-times-circle" aria-hidden="true"></i></a>
        
                <img src="img/portfolio/item-1.png" alt="portfolio">
         </div>
        </div>


but when i click the vendor-1-close i tag, it doesnt hide..

//script

$(function() {
   for(var i=0; i<12; i++){

        $("#vendor-"+i).click(function(){

            $("#vendor-"+i+"-content").show();
        });

        $("#vendor-"+i+"-close").click(function(){

              $("#vendor-"+i+"-content").hide();
        }); 
   }
});


I kind of need this urgently..

17th February, 2017

amitshrestha221 started a new conversation Variable Outside Ajax Request • 4 months ago

I want the result of ajax outside the ajax function. My code is below :


    var result;
        
        $.ajax({
            type: "GET",
            url: append_url,
            datatype: "json",
            success: function(data){
                result = data;
                alert(result);                
            }
        });

        
        alert(result);  // outputs undefined


15th February, 2017

amitshrestha221 left a reply on Autoload A Method • 4 months ago

I am pulling country code and currency in the default controller to gain country code and currency.. But I want them as soon as someone hits the server..

14th February, 2017

amitshrestha221 started a new conversation Autoload A Method • 4 months ago

I want some code to run automatically when you hit the website..

amitshrestha221 started a new conversation Get Currency Unit • 4 months ago

Is there any way to get currency unit using country name?

amitshrestha221 started a new conversation Find Country • 4 months ago

How to get country of the site visitor based on IP or other options?

13th February, 2017

amitshrestha221 left a reply on Get Client's Public IP Address • 4 months ago

I got my solution


$ip = trim(shell_exec("dig +short myip.opendns.com @resolver1.opendns.com"));

dd("Public IP: ".$ip);


amitshrestha221 started a new conversation Get Client's Public IP Address • 4 months ago

How do you get client's public address you get in


[ https://www.whatismyip.com/ ]


2nd February, 2017

amitshrestha221 left a reply on Socialite Error • 4 months ago

should i go with socialite 2.0 ?

amitshrestha221 left a reply on Socialite Error • 4 months ago

5.3

amitshrestha221 left a reply on Socialite Error • 4 months ago

@tisuchi @tomi @willvincent brothers can you please help?

amitshrestha221 started a new conversation Socialite Error • 4 months ago


[email protected]:/usr/share/nginx/html/ampleshop$ composer require laravel/socialite
Using version ^3.0 for laravel/socialite
./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
    - laravel/socialite v3.0.0 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0].
    - laravel/socialite v3.0.2 requires illuminate/support ~5.4 -> satisfiable by illuminate/support[v5.4.0].
    - Conclusion: don't install illuminate/support v5.4.0
    - Installation request for laravel/socialite ^3.0 -> satisfiable by laravel/socialite[v3.0.0, v3.0.2].


Installation failed, reverting ./composer.json to its original content.



31st January, 2017

amitshrestha221 left a reply on During Mail In Laravel 5.3 • 4 months ago

oh it worked, my gmail was locked..

amitshrestha221 started a new conversation During Mail In Laravel 5.3 • 4 months ago


Swift_TransportException in AbstractSmtpTransport.php line 383: Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials p66sm37066032pfb.88 - gsmtp
"


my mail.php


<?php
return array(
    'driver' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => 465,
   'from' => array('address' => 'khubility2016@gmail.com', 'name' => 'amit'),
    'encryption' => 'ssl',
    'username' => 'khubility2016@gmail.com',
    'password' => 'sujina500',
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => false,

);


27th January, 2017

amitshrestha221 left a reply on Middleware Groups • 5 months ago

@tomi thanks brother.. :)

amitshrestha221 left a reply on Middleware Groups • 5 months ago

anyone?

amitshrestha221 started a new conversation Middleware Groups • 5 months ago

By some problem, I am not being able to use middleware groups in routes file..

I'm using


public function __construct(){
    $this->middleware('auth');  
}

in controller. How do I make some controller methods available to guest middleware?

Edit Your Profile
Update

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