amitshrestha221

Web Developer at Peace Nepal DOT Com

Experience

7,290

2 Best Reply Awards

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

22nd October, 2017

amitshrestha221 left a reply on Split Assets Backend And Frontend • 8 hours ago

you can create separate folders inside public folder for user and admin assets.. :)

9th October, 2017

amitshrestha221 started a new conversation Merge Cells In Laravel Excel Export. • 1 week ago

I am exporting excel like this. I ant the C field to be of 3 columns.


$array = ['A','B','C','D'];

$sheet->fromArray(array(
                    $array
                ), null, 'A1', false, false);


25th September, 2017

amitshrestha221 left a reply on Understanding About Helper. • 3 weeks ago

@kenny11 no i meant for some data like retrieving notifications and messages in header, and other small queries, that can be called from a view for minor tasks.

amitshrestha221 left a reply on Understanding About Helper. • 3 weeks ago

@edoc just a curiosity.

amitshrestha221 left a reply on Understanding About Helper. • 3 weeks ago

@tomi @tisuchi @willvincent Sirs, I need your knowledge here please.

amitshrestha221 started a new conversation Understanding About Helper. • 3 weeks ago

Suppose I call a helper method from a view file.

view :


@php $xyz =  Helper::getXYZ(); @endphp


In my helper file I have this method where I perform database queries:

helper:


public static function getXYZ(){
    $xyz = XYZ::all():
    return $xyz;
}


I would like to know if this breaking the flow of MVC pattern? Because we are running DB queries directly from helper method used in view file.

3rd September, 2017

amitshrestha221 left a reply on Use Ip After Using Valet. • 1 month ago

@tisuchi

sir I tried to implement by this link :

[https://laracasts.com/discuss/channels/general-discussion/step-by-step-guide-to-installing-socketio-and-broadcasting-events-with-laravel-51]

All went fine, I just cannot access/ping my server:port

amitshrestha221 left a reply on Use Ip After Using Valet. • 1 month ago

@tisuchi i am using ubuntu, forked version of valet.. My valet is working fine, I just don't know how to access my localhost or local IP.

my view file is following :


<script>
        //var socket = io('http://localhost:3000');
        var socket = io('http://127.0.1.1:3000');
        socket.on("test-channel:App\\Events\\EventName", function(message){
            // increase the power everytime we load test route
            $('#power').text(parseInt($('#power').text()) + parseInt(message.data.power));
        });
    </script>



I ran following socket


 node socket.js
Listening on Port 3000



it listens to port 3000 but I'm not being able to ping by following :


ping 127.0.0.1:3000
ping localhost:3000
ping project.dev:3000


amitshrestha221 started a new conversation Use Ip After Using Valet. • 1 month ago

I am using valet since 7, 8 months. It is working fine. Today, I was about to test socket.io, so i made it listen to port 3000 i.e.


127.0.0.1:3000


But after using valet, my localhost is not accessible. I also tried to access it by using


project.dev:3000


still it is not accessible. By any chance can i access my ip or localhost ??

i tried pinging this is the output.


ping 127.0.0.1:3000

ping: unknown host 127.0.0.1:3000

31st August, 2017

amitshrestha221 started a new conversation Auth Returning False. • 1 month ago


if (Auth::attempt(['email' => Input::get('email'),
                                'password' => Input::get('password'),
                                'user_type_id' => '2'])) {
                print_r(json_encode(['status' => 'success', 'value' => Auth::user()->id]));
                exit;
            }else{
                print_r(json_encode(['status' => 'error', 'value' => 'Sorry, credentials is not valid.'], JSON_PRETTY_PRINT));
                exit;
            }


The email and password is both correct still auth is returning false.

23rd August, 2017

amitshrestha221 started a new conversation About Open Street Maps • 1 month ago

Can anyone please help me integrate OSM in laravel from scratch? I am confused how to render multiple markers in view. Any tutorials will be welcome.

amitshrestha221 left a reply on Session Flash Message Not Working After Redirect Route • 1 month ago

@vandyczech try the above solution please..

amitshrestha221 left a reply on Session Flash Message Not Working After Redirect Route • 1 month ago

with() doesn't create session variable. It just prepares array to the view.

try


Session::flash('status','Message'); 

in controller

and



@if(Session::has('status')
{{ Session::get('status') }}
@endif


in view..

amitshrestha221 left a reply on Count And Get In Same Query • 1 month ago

use DB:: raw in select to get custom count field in the output.

amitshrestha221 left a reply on Looking For OSM Package? • 1 month ago

Does the geotools work with google maps or OSM?

amitshrestha221 started a new conversation Looking For OSM Package? • 1 month ago

Is there any package built for Laravel for integrating Open Street Maps(OSM)?

Regards, A fellow developer.

26th July, 2017

amitshrestha221 started a new conversation Test • 2 months ago

test

6th June, 2017

amitshrestha221 started a new conversation Urgent Solution Required, Paginate Giving Issue. • 4 months 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 • 5 months 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 • 5 months 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 • 6 months ago

@bobbybouwmann what if i wanter all mimes except exe?

amitshrestha221 started a new conversation Blackist Mime • 6 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 • 6 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 • 6 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 • 6 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.. • 7 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.. • 7 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 • 7 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 • 7 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 • 7 months ago

@ri7nz i think your site does it.

amitshrestha221 left a reply on Currency Conversion • 7 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 • 7 months ago

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

amitshrestha221 left a reply on Currency Conversion • 7 months ago

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

amitshrestha221 started a new conversation Currency Conversion • 7 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 • 7 months ago

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

amitshrestha221 left a reply on Laravel Mysql Driver • 7 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 • 7 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 • 7 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 • 7 months ago

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

amitshrestha221 left a reply on URGENT Upgrade Mysql To 5.7 URGENT • 7 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 • 7 months ago

How to upgrade MySQL to 5.7 from cpanel?

22nd February, 2017

amitshrestha221 started a new conversation Row Deletes Only Once.. • 8 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.. • 8 months ago

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

amitshrestha221 started a new conversation Cart Not Accepting Options.. • 8 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.. • 8 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.. • 8 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 • 8 months ago

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

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

is the form being submitted or not?

Edit Your Profile
Update

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