raviawasti

raviawasti

Member Since 4 Months Ago

Experience Points 1,630
Experience Level 1

3,370 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 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

16 May
6 days ago

raviawasti started a new conversation How To Show One Row Into Bootstrap Col-md-3,col-md-4 & Col-md-5 In Laravel By Using Foreach?

Currently I am showing my blogs like this:-

@foreach($blog as $item) col-md-4, col-md-4, col-md-3 @endforeach

But i want to show my 1st row of blog divided into col-md-3 ,col-md-4,col-md-5

raviawasti started a new conversation How To Divide Blog With For-each Loop In Laravel?

Currently I am showing my blogs like this:- @foreach($blog as $item)

Some data Some data Some data @endforeach

But i dont to show my blog like this:-- First row

Second row Third row
07 May
2 weeks ago

raviawasti started a new conversation How To Set Two Isset In View Laravel?

i want to check both locatiion name and subject in laravel, how can i do that:--

@if(isset($data['location']->name) && ($data['subject']->subject_code))

Testing data

@endif
30 Apr
3 weeks ago

raviawasti started a new conversation How To Get Current Url In Laravel?

I have dynamic url in laravel like this,

www.abcd.com/teacher-jobs-in-india

I want to get only teacher-jobs-in-india in my variable , how can i do that??

While doing this i get

www.abcd.com/teacher-jobs-in-india

but i want this only /teacher-jobs-in-india

24 Apr
4 weeks ago

raviawasti left a reply on My Homepage Is Working But Not Other Pages In Laravel?

i resolved my issue myself in 2 step:-

first step go to .htacess files and paste the above code

Options -MultiViews

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ / [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

second step was:-

actually storage folder was not given 755 permission by giving permisson to that folder i resolved my problem..its working now..

raviawasti left a reply on How To Remove Public Path From Url In Laravel?

Not working for me:-

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.

raviawasti started a new conversation My Homepage Is Working But Not Other Pages In Laravel?

I have a laravel project installed in linux localhost(Xampp).

My url is http://localhost/webhouse/public whenever i open this path homepage loads, but when i click on other url such as about,login,register,contact it says:-

Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404 localhost Apache/2.4.37 (Unix) OpenSSL/1.0.2q PHP/7.3.1 mod_perl/2.0.8-dev Perl/v5.16.3

how can i resolve this issue..

raviawasti started a new conversation How To Remove Public Path From Url In Laravel?

I am working on linux with xampp installed on localhost .

I have a folder inside /opt/lampp/htdocs called webhouse in which laravel project exists.

But whenever i open this url

http://localhost/webhouse

it says to open with public path like this http://localhost/webhouse/public

But i want to open my project with this url http://localhost/webhouse not by this http://localhost/webhouse/public.

Inshort i want to remove public from url..

11 Apr
1 month ago

raviawasti started a new conversation How To Set Route In Laravel For Seo?

I had set my route like this

Route::get('teacher-jobs/{subject}/{city}','[email protected]');

https://www.abcde.com/teacher-jobs/computer/patna

is there any disadvantage to set like this the above way..

And any advantage in seo if my route will be like this:-

Route::get('{subject}- teacher-jobs-in- {city}','[email protected]');

https://www.abcde.com/computer-teacher-jobs-in-patna

raviawasti left a reply on How Can I Add Pass Slug In Route In Laravel?

@NISEKU - Thanks a lot it solved my problem....

raviawasti started a new conversation How Can I Add Pass Slug In Route In Laravel?

I want to pass slug to my route,here is the example

Route::get('{slug}/teacher-jobs', '[email protected]');

Here are my slug which i pass to the route 1}math 2}hindi 3}social-studies 4}computer-science my slug is working perfectly fine for math and hindi but when i pass social-studies & computer-science to them its 404 error

how can i pass social-studies & computer-science to route please help

06 Apr
1 month ago

raviawasti left a reply on How To Delete Multiple Fields From Users Table In Laravel?

@SERGIU17 - are you sure at one time all the 20000 fields will be deleted ??

raviawasti started a new conversation How To Delete Multiple Fields From Users Table In Laravel?

I have User table where fields are id ,type, email, phone, address etc

example of some data are 1, student, [email protected],7676767676, patna 2, school, [email protected],1212123456, bihar

I have 50,000 data in users table in which 20,000 are type student remaining are school

My query is i want to delete all the 20,000 items where type is student only ,not school ,how can i do it in laravel?

25 Mar
1 month ago

raviawasti started a new conversation How To Check User_id Exist And Email Not Empty At The Same Time In Laravel?

I have school_details table where i save id,user_id , email.phone, etc I want to check if the user_id exist and email is not empty in school_details table ? i am using this code to check user_id exist or not but i want to check both email & user_id

if (SchoolDetails::where('user_id', '=', Auth::User()->id)->exists()) {

    return view('frontend.schools',compact('active_class','classes'));
  }
  else{
            return redirect('/account')->with('error', 'Kindly update your school details first !');

}

How can i do that?

23 Mar
1 month ago

raviawasti started a new conversation How To Show All Data Form Users Table Only When Its Detail Doesnot Exist In User_details Table In Laravel?

I have two table one users and other user_details. Users tabel id,name,phone,email user_details tabel id, user_id, address, city

i am saving id of user in user_details as user_id. i want to show all users data only when users hasnot updated their user_details table..

14 Feb
3 months ago

raviawasti left a reply on How Can I Save Duplicate Record In Laravel ?

@NISEKU - Route::get('openings/duplicate/{id}', '[email protected]');

public function duplicate($id) {

$openings = Openings::find($id);

$openings = clone $openings;

$openings->save();

}

raviawasti left a reply on How Can I Save Duplicate Record In Laravel ?

@VILFAGO - Should i do like this:- Route::get('openings/duplicate/{id}', '[email protected]');

 public function duplicate($id)  {

$openings = Openings::find($id); $openings = clone $openings; $openings->id = NULL; $openings->save();

        }

raviawasti left a reply on How Can I Save Duplicate Record In Laravel ?

Should i do like this:- Route::get('openings/duplicate/{id}', '[email protected]');

 public function duplicate($id)  {

$openings = Openings::find($id); $openings = clone $openings; $openings->id = NULL; $openings->save();

        }

raviawasti started a new conversation How Can Make Duplicate A Record In Laravel ?

how can i replicate a same record with some changes in laravel

for example i have a record saved in database in openings table

example: id :1 name:class one jobs class:one startdate:12/01/2018 enddate:13/04/2018 status:active

i want to replicate same record in openings table by clicking on replicate button.Copy same record and create new one just like this:

id:2 name:class one jobs class:one startdate:12/01/2018 enddate:13/04/2018 status:active

06 Feb
3 months ago

raviawasti started a new conversation How To Show Data Status That It Exist In User Table Or Not?

I have user table and call_records table

user table id,phone,email,status etc call_records table id, phone, email etc

i am saving phone, email, on call_records tabel but i want user in call record index that specific user exist with that number or not.. my function: $records= CallRecords::orderBy('id','desc')->paginate(10);

my index view:- @foreach($records as $item)

@if(App\User::where('phone', '=', $item->phone)->exists()) {

User registered

} @else{

Not registered yet

} @endif @endphp

@endforeach

raviawasti left a reply on How Can I Check Phone Number Exist Or Not From User & Payments Tables

@DOUGLASAKULA - I want to search phone & email both in user & payments table..

I am using this but not working

if (Payments::where('phone', '=', $request->phone)->orwhere('email', '=', $request->email)->exists() || User::where('phone', '=', $request->phone)->orwhere('email', '=', $request->email)->exists()) { return Redirect()->back()->withInput()->with('error', 'Number or email exist!');

}

raviawasti left a reply on How Can I Check Phone Number Exist Or Not From User & Payments Tables

@DOUGLASAKULA - Thank you soo much i need a little bit more help

raviawasti started a new conversation How Can I Check Phone Number Exist Or Not From User & Payments Tables

How can i check phone number which exist or not in user & payment table.

I have user table which has id, name, phone, email etc & payments table which has id, phone, status

I am able to search phone number from Payments table like this:-

public function search(Request $request) {

if (Payments::where('phone', '=', $request->phone)->exists()) {

               return Redirect()->back()->withInput()->with('error', 'This Number exist !');

}

else{ return Redirect()->back()->withInput()->with('success', 'This Number not exist!'); }

}

But i want to search from both table users & payments table in laravel

31 Jan
3 months ago

raviawasti started a new conversation How Can I Get 3 Table Data In Index In Laravel?

I have 3 tables schools, school_Details,ratings

** Schools**

id

name

phone

school

email

status

School details:

-id

school_id

image

status

ratings:

-id

school_id rating_value status both rating &school details have only one row for one school_id.

Now how can i get all details from all 3 tables in index from schoolController

27 Jan
3 months ago

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@CECOSD - Thank you sir..my problem resolved..thanks alot

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - My problem is still not resolved, can you please guide me?

25 Jan
3 months ago

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - i dont have any relationship for it can you plese guide me through?please

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - <?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable; use Zizaco\Entrust\Traits\EntrustUserTrait; use Laravel\Cashier\Billable; use Cmgmyr\Messenger\Traits\Messagable;

class LeadTypes extends Authenticatable { protected $table = 'lead_types';

    public function LeadTypes()
  {
    return $this->belongsTo('App\LeadTypes','lead_type');
  }

}

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - <?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable; use Zizaco\Entrust\Traits\EntrustUserTrait; use Laravel\Cashier\Billable; use Cmgmyr\Messenger\Traits\Messagable;

class LeadTypes extends Authenticatable { protected $table = 'lead_types';

    public function LeadTypes()
  {
    return $this->belongsTo('App\LeadTypes','lead_type');
  }

}

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - i had passed the variable like this..

return view('leadtypes.form2',$data,compact('item','classes','item_class_ids')); but still getitng this error, i am getting error due to this line

$item_class_ids[$class->id] = $class;

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@CECOSD - Trying to get property of non-object LeadTypesController.php line 83:

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - I am doing exactly same you you said but getting Invalid argument supplied for foreach()

public function editForm($id) { $item = LeadTypes::findOrFail($id); $data['active_class'] = 'Lead type'; $data['title'] = getPhrase('Lead type'); $classes = Classes::pluck('name','id'); $item_class_ids =[ ]; foreach ($item->name as $class) { $item_class_ids[$class->id] = $class; }

return view('leadtypes.form2',$data,compact('item','classes',' item_class_ids ')); }

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - thank you sir.. i am testing it..and reply you soon

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@CECOSD - i had combined mmade the image in paint may be some id will be mismatched

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@CECOSD - Thank you soo much that you replied me.. your doubt will be cleared what i actually want from the image..please help me after seeing it...

https://photos.app.goo.gl/J49LVrrohaQpPfU37

24 Jan
3 months ago

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@YEZAWHEIN - Shall I use it in edit function or add function

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

@CECOSD - When i save & edit like this then it comes on my dropdown $classes = Classes::pluck('name','name'); $item->name = explode(',', $item->name);

But when i do like this $classes = Classes::pluck('name','id'); $item->name = explode(',', $item->name); it doenot come on dropdown selected

raviawasti left a reply on How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

When i save & edit like this then it comes on my dropdown $classes = Classes::pluck('name','name'); $item->name = explode(',', $item->name);

But when i do like this $classes = Classes::pluck('name','id'); $item->name = explode(',', $item->name); it doenot come on dropdown selected

raviawasti left a reply on Get Value From Multiple Select Box

@PAVLEN - But how can i have the multiple selected value in dropdown ??

raviawasti started a new conversation How To Have Multiple Selected Item In Drop-down If Saved In Id Laravel?

I am selecting the multiple id of classes in creating leadtype via explode,how can i get all the selected id of classes in dropdown in edit function

Classes table

id 1 name class one id 2 name class two id 3 name class three

Leadtype table

id 1 class_id 1,2,3, id 2 class_id 1,2 id 3 class_id 2,1

I am saving only id of classes in leadtype table but when i edit i want all the value selected instead of id

my route Route::get('admin/leadtypes/form', '[email protected]'); add Route::post('admin/leadtypes/post', '[email protected]'); store Route::get('admin/leadtypes/form/{id}', '[email protected]'); edit

Add function public function form() { $classes = Classes::pluck('name','id'); return view('leadtypes.form',$data,compact('classes'));

    }

My store/update function

public function update(Request $request) { $data = \Input::except(array('_token')) ;

                $rule=array(
                  'name'   => 'required',

                         );

   $validator = \Validator::make($data,$rule);

  if ($validator->fails())
  {
          return redirect()->back()->withInput()->withErrors($validator->messages());
  }
  $inputs = $request->all();

  if(!empty($inputs['id'])){

      $item = LeadTypes::findOrFail($inputs['id']);

  }else{

      $item = new LeadTypes;

  }
  if(is_array($request->name)){
              $item->name = implode(',', $request->name);
            }
  $item->status = $inputs['status'];
 
  $item->save();
  flash('success','record_added_successfully', 'success');
return redirect('admin/leadtypes');

}

edit function

public function editForm($id)
{
  $item = LeadTypes::findOrFail($id);
  $data['active_class']       = 'Lead type';
  $data['title']              = getPhrase('Lead type');
$classes =  Classes::pluck('name','name');
$item->name =   explode(',', $item->name);
 return view('leadtypes.form',$data,compact('item','classes'));
}

My view dropdown

{!! Form::select('name[]', $classes, !empty($item->name) ? $item->name : explode(',',old('name')) ,['class' =>'form-control ' ,'required'=>'true','multiple'=>'true']); !!}

23 Jan
3 months ago

raviawasti started a new conversation How To Show Multiple Selected Data While Editing In Drop Down Using Selectize In Laravel?

I am imploding multiple id of subject table via selecting it and saving it in Users table , i am successully saving the data in users table but when i am trying to edit the the user by exploding it subject field is not showing in dropdown..

imploding it like:1,2,3 i want all selected subject of above id in dropdown

Saving the data like this

if (is_array($request->subject)) { $item->subject = implode(',', $request->subject); }

Add function to show subject list

public function editForm($id) { $item = Users::findOrFail($id);

$subjects = Subject::pluck('subject_title', 'id');
$item->subject = explode(',', $item->subject);

return view('users.form', $data, compact('item', 'subjects'));

}

my edit & add form dropdown

{!! Form::select('subject[]',$subjects, !empty($item->subject) ? $item->subject :explode(',',old('subject')),['class' =>'form-control ' ,'required'=>'true','multiple'=>'true'] ); !!}

18 Jan
4 months ago

raviawasti started a new conversation How Can I Update Two Table Admission & Payments When Payment Is Successful In Laravel Paytm?

I am saving name, class, subject, user_id in admission table except payment_status and then after clicking on pay now button payments data such as payment_id, user_id, transaction_id, payment_status etc is captured in Payments table.

Now how can i update payment_status field in admission when payment is successful in paytm?

public function paynow(Request $request, $slug) { $payment_gateway = $request->gateway;

      if($payment_gateway=='paytm'){

           
     $order_id = strtolower(str_random(25));


    $token = $this->preserveBeforeSave($item,$order_id, $type,  $payment_gateway, $other_details);

    $data_for_request = $this->handlePaytmRequest( $order_id, $amount );


    $paytm_txn_url = 'https://securegw.paytm.in/theia/processTransaction';
    $paramList = $data_for_request['paramList'];
    $checkSum = $data_for_request['checkSum'];



    return view('payments.paytm',compact('paytm_txn_url','token', 'paramList', 'checkSum' ));


  }

  dd('please wait...');
}

public function handlePaytmRequest( $order_id, $amount ) {
    // Load all functions of encdec_paytm.php and config-paytm.php
    $this->getAllEncdecFunc();
    $this->getConfigPaytmSettings();

    $checkSum = "";
    $paramList = array();

    // Create an array having all required parameters for creating checksum.
    $paramList["MID"] = 'ytrytrytrytrty';
    $paramList["ORDER_ID"] = $order_id;
    $paramList["CUST_ID"] = $order_id;
    $paramList["INDUSTRY_TYPE_ID"] = 'Rta109';
    $paramList["CHANNEL_ID"] = 'WEB';
    $paramList["TXN_AMOUNT"] = '299';
    $paramList["WEBSITE"] = 'WEBPROD';
    $paramList["CALLBACK_URL"] = url( 'https://www.ravi.com/payments/paytm/paytmCallback' );
    $paytm_merchant_key = 'ytgduzyMHCahghghg9LlXnHlZ';

    //Here checksum string will return by getChecksumFromArray() function.
    $checkSum = getChecksumFromArray( $paramList, $paytm_merchant_key );

    return array(
        'checkSum' => $checkSum,
        'paramList' => $paramList
    );
}


public function paytmCallback( Request $request ) {
  

    $order_id = $request['ORDERID'];
           $user = Auth::user();


    if ( 'TXN_SUCCESS' === $request['STATUS'] ) {
        $transaction_id = $request['TXNID'];
        $status = $request['STATUS'];
       
        if($this->paymentSuccess($request))
    {


   
    }
    else {
   
    }

  //REDIRECT THE USER BY LOADING A VIEW

            return \Redirect()->route('account')->with('danger', 'Your payment was successfull, now you can give exam within 15 days');

    } else if( 'TXN_FAILURE' === $request['STATUS'] ){
            return \Redirect()->route('account')->with('danger', 'Your payment was failed, kindly try again');
    }
}

 public function preserveBeforeSave($item, $order_id, $package_type,$payment_method)
{
  $payment          = new Payment();
  $payment->item_id     = $item->id;
  $payment->item_name     = $item->title;
  $payment->plan_type     = $package_type;
  $payment->payment_gateway = $payment_method;
  $payment->slug      = $order_id;
  $payment->cost      = $item->cost;
  $payment->user_id     = $user->id;
  $payment->payment_status  = PAYMENT_STATUS_PENDING;

  $payment->save();
  return $payment->slug;
}
16 Jan
4 months ago

raviawasti left a reply on How Can I Avoid Image Required In Edit Form If Image Exist In Laravel?

@SAURABHD - not working as you said i am applying like this

In my controller

    public function rules()

{ $child_details = Children::findOrFail($inputs['id']); $rules = [ 'child_name' => 'required', 'gender' => 'required', 'dob' => 'required', 'current_class' => 'required', 'b_group' => 'required', 'm_tongue' => 'required', 'image' => 'image', ];

if ($child_details->notHavingImageInDb()){
    $rules['image'] = 'required|image';
}
return $rules;

}

public function Postchild(Request $request) {

        $data =  \Input::except(array('_token')) ;
         $validator = \Validator::make($data,$rules);
         $inputs = $request->all();
         if ($validator->fails())
        {
                return redirect()->back()->withInput()->withErrors($validator->messages());
        }
      
          if(!empty($inputs['id'])){
            $child_details = Children::findOrFail($inputs['id']);
        }else{
            $child_details = new Children;
        }


       $child_details->parent_id = Auth::User()->id;
       $child_details->child_name = $inputs['child_name'];

       $child_image = $request->file('image');

    if($child_image){

        $tmpFilePath = 'uploads/childrens/';
         $extension =   $child_image->getClientOriginalExtension();
        $hardPath =  str_slug($inputs['child_name'], '-').'-'.md5(time());


        $img = Image::make($child_image);

        //$img->resize(180)->save($tmpFilePath.$hardPath.'-b.jpg');
        $img->fit(250, 250)->save($tmpFilePath.$hardPath.'.'.$extension);

        $child_details->image = $hardPath.'.'.$extension;

    }
     
        $child_details->save();

   

if(!empty($inputs['id'])){

            return \Redirect()->route('child_list')->with('success', 'Child has been updated');


    }else{

            return \Redirect()->route('child_list')->with('success', 'Child has been added');


    }    

}

but getting undefined rules variable

raviawasti started a new conversation How Can I Avoid Image Required In Edit Form If Image Exist In Laravel?

I am adding and editing a user with same function (Store), when ever i add a user it asks me image is required but whenever i edit a user which have image it also ask me image is required and i want if a image is already present it wont ask me

I am saving like this

public function store(Request $request) { $rule=array( 'name' => 'required',

           'image' => 'required',
                             );
                             
          if(!empty($inputs['id'])){
                $user = User::findOrFail($inputs['id']);
            }else{
                $user = new User;
            }

    $user_image = $request->file('image');

   if($user_image){
   
        $tmpFilePath = 'uploads/candidates/';

        $hardPath =  str_slug($inputs['name'], '-').'-'.md5(time());
        $img = Image::make($user_image);
        $img->fit(300, 300)->save($tmpFilePath.$hardPath.'-b.jpg');
        $user->image = $tmpFilePath.$hardPath.'-b.jpg';

    }
          $user->name = $inputs['name'];
          $user->save();

    }