anandmainali5

anandmainali5

Member Since 1 Year Ago

Kathmandu

Experience Points 9,090
Experience Level 2

910 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 75
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.

23 Dec
7 months ago

anandmainali5 left a reply on Error On Uploading Vendor Folder To Cpanel.

@DOUGLASAKULA - My hosting provider doesn't provide access to ssh.. Can you give me some alternative solutions please..

anandmainali5 started a new conversation Error On Uploading Vendor Folder To Cpanel.

When i upload the vender folder in cpanel i get the error saying "The file you uploaded, vendor.zip, contains a virus so the upload was canceled: Sanesecurity.Foxhole.Zip_bat.UNOFFICIAL FOUND". Can you guys help me??

10 Aug
1 year ago

anandmainali5 left a reply on 403 Forbidden In Laravel Project In Cpanel

@Saikishore I am using the same .htaccess code and it works perfectly. But in this project i am getting this 403 error.

anandmainali5 left a reply on 403 Forbidden In Laravel Project In Cpanel

@saravana2906 can you provide me .htaccess code to solve this problem??

anandmainali5 left a reply on 403 Forbidden In Laravel Project In Cpanel

@MThomas When i upload my laravel app to the server it is showing 403 Forbidden error. But it is perfectly working in the localhost. I am getting this error in error log : File not found [/home/anandmainali/public_html/403.shtml].

anandmainali5 started a new conversation 403 Forbidden In Laravel Project In Cpanel

How to solve 403 forbidden error in laravel project ??

21 Mar
1 year ago

anandmainali5 started a new conversation How To Send Email Into Gmail From Laravel?

I have a form for making appointment. Whenever users make a appointment the details of users must be sent to official gmail (ex:[email protected]). How can i do it ? Does i need to provide gmail-password in ".env" file. But my client doesn't want to share his password. How can i solve this ??

19 Mar
1 year ago

anandmainali5 left a reply on Fetching Only Image From Database

@Sergiu17 thanks a lot for your answer. With your help i solved all the above problems.

anandmainali5 left a reply on Fetching Only Image From Database

@Sergiu17 Thanks a lot. Everythings works fine. But i am getting all the images of that album. But i only want the first item of that album. And after clicking in it all the images associated with that album will displayed in different page.. How can i solve this?

anandmainali5 started a new conversation Fetching Only Image From Database

I have a table 'albums' and the columns 'id','name' and another table 'images' and the columns 'id','album_id','image'. Now i want to display all the album name and the first image associated with that album. How can i do it??

                <div class="col-md-6">
              <h5>{{$album->name}}</h5>
              //How to display all the images here associated with the album
                    
                </div>
             @endforeach
17 Mar
1 year ago

anandmainali5 started a new conversation How To Add Array Of Image In Db In A Single Row?

I want to make a photo gallery. In which i want to show the title and first image from the array. And after clicking the image other image should be displayed in the another page with it. Every time i add a photos it should be created a album in the gallery? How can i make it? Can someone helpme to code this?

anandmainali5 started a new conversation Voyager Image Broken After Uploading In Server

I uploaded my project into the root directory in cpanel and the public folder in a 'public_html'. Now when i add a image the image are not showing . How to fix it?

13 Mar
1 year ago

anandmainali5 started a new conversation Problem With Updating Role By All User In Voyager

How to solve the problem of updating user role other than admin in voyager??

09 Mar
1 year ago

anandmainali5 started a new conversation Getting Error In Route


Route::delete('/cart/{product}','[email protected]')->name('cart.destroy');

//form

<form action="{{route('cart.destroy',$item->rowId)}}" method="post">
                    {{csrf_field()}}
                    {{method_field('DELETE')}}
                    <button type="submit" class="btn btn-danger btn-sm"><i class="fa fa-trash-o"></i></button>
                </form>

Why i am getting error "Route [] not defined"??
08 Mar
1 year ago

anandmainali5 started a new conversation Access Denied For User 'root'@'localhost' (using Password: NO)

SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from sessions where id = I4acWY0LwZppE8foHCNokp5Fb3iJK2QD7pm4UrpG limit 1) in mysql. How to solve it?

07 Mar
1 year ago

anandmainali5 started a new conversation Help Plz!! How To Upload Laravel Projects Into Subfolders In Cpanel

I want my project open when i enter the url http://abcnepal.com/laravel . How to do it? I have google it many times but it didn't work for me. I got pane not working error. How to fix it?

28 Feb
1 year ago

anandmainali5 started a new conversation Are There Any E-commerce Package To Create E-commerce Site Easily?

I want to create e-commerce site same as amazon? Is there any easy way to create it?

anandmainali5 started a new conversation Is Vanilo Perfect To Create A E-commerce Site?

I want to create a e-commerce site same as amazon. Is there any libraries to create e-commerce site? Is vanilo perfect?

30 Jan
1 year ago

anandmainali5 left a reply on Problem With DB Transactions

@akilrajdho May be you must try "php artisan migrate:refresh" after you change the column name from invoice_id to invoice_ids.

anandmainali5 left a reply on How To Use Dropzone.js With Additional Field And Submit Button

@burlresearch But when i drop the files it is automatically uploading. I also want extra text field in the form and when i hit the submit button then the data is submitted.

anandmainali5 left a reply on How To Use Dropzone.js With Additional Field And Submit Button

@burlresearch Sorry but i am not a premium user.. Can u provide me some other ways to solve my problem.

anandmainali5 started a new conversation How To Use Dropzone.js With Additional Field And Submit Button

I want to use Dropzone.js for multiple image upload. I also wanna add a image title field and the image should be uploaded when i hit the submit button? Can u plz help me??

anandmainali5 left a reply on How To Set Default Picture If User Doesn't Upload The Picture??

@Thyrosis Applying if condition in mutator works perfectly. I don't need to make my own function. Anyway thanks all of u.

protected $location = '/Images/logo/';
    public function getImageAttribute($image){
        if ($image) {
           return $this->location.$image;
        }
        
    }

anandmainali5 left a reply on How To Set Default Picture If User Doesn't Upload The Picture??

@tisuchi I think that the mutator is placing the location while i am calling the image in my blade.. How to fix it?

anandmainali5 left a reply on How To Set Default Picture If User Doesn't Upload The Picture??

@tisuchi Yeah i've tried but it is not showing inside the if statement.

                      <img src="{{$association->image}}" class="img-thumbnail img-responsive doctor" alt="">
                @else
                     <img src="/Images/logo/hospital.png" class="img-thumbnail img-responsive doctor" alt="" />
                @endif

I'm also using mutator in my code..

protected $location = '/Images/logo/';
    public function getImageAttribute($image){
        return $this->location.$image;
    }


anandmainali5 started a new conversation How To Set Default Picture If User Doesn't Upload The Picture??

I want to set a default photo for users if user left the upload field blank. And want to set the users photo if they upload their own picture?

28 Jan
1 year ago

anandmainali5 started a new conversation How To Fetch All Row Form Database Except One?

I want to show all the users except the current user. How can i do it? Currently my code is

public function index() {

    $users = User::paginate(4);
    return view('admin.Users.index',compact('users'));
}

anandmainali5 left a reply on Two Forms In One Page

@BezhanSalleh Thanks for solving my problem.

anandmainali5 left a reply on Two Forms In One Page

@zainudinnoori No. Still the same problem.

anandmainali5 left a reply on Two Forms In One Page

@zainudinnoori The form is not redirecting to the controller. I am getting page not found error after submitting the from.

27 Jan
1 year ago

anandmainali5 left a reply on Two Forms In One Page

@zainudinnoori I still have the problem?? When i submit the form nothing is returning? But i am returning all() the values from the form in my controller?

anandmainali5 left a reply on Two Forms In One Page

@Snapey Now can you help me?

//Route


Route::post('/admin/updateUser/{$id}', '[email protected]')->name('updateUser');
     Route::post('/admin/updatePassword/{$id}', '[email protected]')->name('updatePassword');


//Controller

public function updateUser(Request $request,$id){
       return $request->all();
   }

   public function updatePassword(Request $request,$id){
       return $request->all();
   }




//Form 1


<form action="{{route('updateUser',Auth::user()->id)}}" method="POST" enctype="multipart/form-data">
                                
                               
         <div class="form-group">
                  {!! Form::label('uname','Username')!!}
                  {!! Form::text('uname',null,['class'=>'form-control'])!!}
         </div>

         <div class="form-group">
                  {!! Form::label('email','Email')!!}
                  {!! Form::email('email',null,['class'=>'form-control'])!!}
         </div>

         <div class="form-group">
                  {!! Form::label('image','Photo')!!}
                 {!! Form::file('image',['class'=>'form-control'])!!}
        </div>                               
                               
       <div class="form-group">                        
                   {!! Form::submit('Update User',['class'=>'btn btn-primary pull-right'])!!}
        </div>
</form>





//Form 2


<form action="{{route('updatePassword',Auth::user()->id)}}" method="POST">
               <div class="form-group">
                        {!! Form::label('oldPassword','Old Password')!!}
                        {!! Form::password('oldPassword',['class'=>'form-control'])!!}
               </div>

               <div class="form-group">
                        {!! Form::label('newPassword','New Password')!!}
                       {!! Form::password('newPassword',['class'=>'form-control'])!!}
                </div>

              <div class="form-group">
                        {!! Form::label('confirmPassword','Confirm Password')!!}
                        {!! Form::password('confirmPassword',['class'=>'form-control'])!!}
               </div>

               <div class="form-group">                        
                     {!! Form::submit('Update Password',['class'=>'btn btn-primary pull-right'])!!}
               </div>
</form>```

anandmainali5 left a reply on Need Help In Coverting Html Code To Text

@Snapey So how to avoid XSS vulnerabilities??

anandmainali5 left a reply on Unable To Access Methods On User Model Using Auth::user()

I am also having the same issue? Didn't find the way to solve?

anandmainali5 left a reply on Two Forms In One Page

@Snapey I have changed the Form library?? Now can you help me out?

//Form 1

                                    <div class="form-group">
                                        {!! Form::label('uname','Username')!!}
                                        {!! Form::text('uname',null,['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('email','Email')!!}
                                        {!! Form::email('email',null,['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('image','Photo')!!}
                                        {!! Form::file('image',['class'=>'form-control'])!!}
                                    </div>                               
                            
                                    <div class="form-group">                        
                                        {!! Form::submit('Update User',['class'=>'btn btn-primary pull-right'])!!}
                                    </div>
                            
                            </form>

//Form 2

{!! Form::label('oldPassword','Old Password')!!} {!! Form::password('oldPassword',['class'=>'form-control'])!!}
                                    <div class="form-group">
                                        {!! Form::label('newPassword','New Password')!!}
                                        {!! Form::password('newPassword',['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('confirmPassword','Confirm Password')!!}
                                        {!! Form::password('confirmPassword',['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">                        
                                        {!! Form::submit('Update Password',['class'=>'btn btn-primary pull-right'])!!}
                                    </div>
                            
                            </form>

anandmainali5 left a reply on Need Help In Coverting Html Code To Text

@Snapey Why it is dangerous? I am doing like this? Is it good or not? And what is the best method?

{!!html_entity_decode($disorder->about)!!}

anandmainali5 started a new conversation Two Forms In One Page

I want to update users data from two forms.. How to update it?? I am also getting error in when i submit the form. The routes is not going to the controller. So it is giving me page not fount error.

// Route

Route::post('/admin/updateUser/{$id}', '[email protected]')->name('updateUser'); Route::post('/admin/updatePassword/{$id}', '[email protected]')->name('updatePassword');

//Controller

public function updateUser(Request $request,$id){ return $request->all(); }

public function updatePassword(Request $request,$id){
    return $request->all();
}

//Form 1

{!! Form::model(Auth::user(),['method'=>'PATCH','action'=>['[email protected]',Auth::user()->id],'files'=>true])!!}

                                    <div class="form-group">
                                        {!! Form::label('uname','Username')!!}
                                        {!! Form::text('uname',null,['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('email','Email')!!}
                                        {!! Form::email('email',null,['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('image','Photo')!!}
                                        {!! Form::file('image',['class'=>'form-control'])!!}
                                    </div>                               
                            
                                    <div class="form-group">                        
                                        {!! Form::submit('Update User',['class'=>'btn btn-primary pull-right'])!!}
                                    </div>
                            
                            
                            {!! Form::close()!!}

//Form 2

{!! Form::open(['method'=>'POST','action'=>['[email protected]',Auth::user()->id]])!!}

                                    <div class="form-group">
                                        {!! Form::label('oldPassword','Old Password')!!}
                                        {!! Form::password('oldPassword',['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('newPassword','New Password')!!}
                                        {!! Form::password('newPassword',['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">
                                        {!! Form::label('confirmPassword','Confirm Password')!!}
                                        {!! Form::password('confirmPassword',['class'=>'form-control'])!!}
                                    </div>

                                    <div class="form-group">                        
                                        {!! Form::submit('Update Password',['class'=>'btn btn-primary pull-right'])!!}
                                    </div>
                            
                            
                            {!! Form::close()!!}

anandmainali5 left a reply on Can't Update A Form Leaving The Password Field Empty

@Snapey Oh sorry i didn't notice the filled(). And finally thanks. It works perfectly..

anandmainali5 left a reply on Can't Update A Form Leaving The Password Field Empty

@shez1983 i have tried many times but can't solve it.. Will you help me by editing the above code correctly so that works??

anandmainali5 started a new conversation Need Help In Coverting Html Code To Text

How to convert this code to text with these properties while displaying?

Osteoarthritis (OA)

anandmainali5 left a reply on Send Password Reset Link In Users Gmail

@bashy It is a production environment?? can you give idea on both environment?? Any mailserver which is free of cost?

26 Jan
1 year ago

anandmainali5 left a reply on Can't Update A Form Leaving The Password Field Empty

yeah its not working so how to fix it.. So that i can leave the password field empty with old password

anandmainali5 left a reply on Can't Update A Form Leaving The Password Field Empty

I have this function to update the password but if i leave the password field empty then the password is updated to empty. i want the old password if it is left empty.

public function update(Request $request, $id) {

    //
    $user = User::findOrFail($id);
    $this->validate($request, [
        'uname' => 'required|min:3|max:25',
        'email' => ['required','email',
                    Rule::unique('users')->ignore($id),],
        'utype' => 'required',
        'status' => 'required',
        'image' => 'mimes:jpeg,png,gif,bmp,tiff',
        'password' => '',
        'cpass' => 'same:password',

    ]);
    $data = [
        'uname' => $request->uname,
        'email' => $request->email,
        'status' => $request->status,
        'utype' => $request->utype,
        
    ];
    if($request->hasfile('image')){
        $file = $request->image;
        $name = time() . $file->getClientOriginalName();
        unlink(public_path().$user->image);
        $file->move('UserImage',$name);
        $data['image'] = $name;
    }    
    if ($request->has('password')) $data['password'] = bcrypt($request->input('password'));    
    
    $user->update($data);


    return redirect()->route('user.index')->with('success','User successfully updated.');
}

anandmainali5 started a new conversation Can't Update A Form Leaving The Password Field Empty

Want to update the password if the password is given otherwise leave the old password? How to do it?

anandmainali5 left a reply on Send Password Reset Link In Users Gmail

don't i need to configure the .env file for mail

anandmainali5 started a new conversation Send Password Reset Link In Users Gmail

How do i send a password reset link in users gmail account?

25 Jan
1 year ago

anandmainali5 left a reply on Automatically Logout Of Dashboard

no after i refresh the page then it redirects to login page

anandmainali5 started a new conversation Automatically Logout Of Dashboard

//User class

public function isAdmin(){

    if($this->status == '1'){

        return true;

    }

    return false;

}

//Admin Middleware

public function handle($request, Closure $next)

{
    if(Auth::check()){

        if(Auth::user()->isAdmin()){

            return $next($request);

        }

    }

    return redirect()->route('login');


}

}

Why my isAdmin() is not accessible in admin middleware?? And when i login to the dashboard it automatically redirects to the login page after few seconds? The problem is in the middleware. How to solve it?