/**
  * Get user collection.
  *
  * @param  int  $id
  * @return Illuminate\Support\Collection
  */
 public function edit($id)
 {
     $profile = $this->profile->find($id);
     //dd($profile);
     return compact('profile');
 }
    /**
     * Datatables data
     *
     * @return Datatables JSON
     */
    public function data()
    {
        //		$query = Profile::select(array('profiles.id','profiles.first_name','profiles.last_name','profiles.email_1','profiles.email_2'))
        //			->orderBy('profiles.last_name', 'ASC');
        //		$query = Profile::select('id', 'first_name', 'last_name', 'email_1', 'email_2')
        //			->orderBy('last_name', 'ASC');
        $query = Profile::select('id', 'first_name', 'last_name', 'email_1', 'email_2')->orderBy('profiles.last_name', 'ASC');
        //dd($query);
        return Datatables::of($query)->addColumn('actions', '
					<a href="{{ URL::to(\'profiles/\' . $id . \'/\' ) }}" class="btn btn-info btn-sm" >
						<span class="glyphicon glyphicon-search"></span>  {{ trans("kotoba::button.view") }}
					</a>
					<a href="{{ URL::to(\'profiles/\' . $id . \'/edit\' ) }}" class="btn btn-success btn-sm" >
						<span class="glyphicon glyphicon-pencil"></span>  {{ trans("kotoba::button.edit") }}
					</a>
				')->make(true);
    }
 /**
  * @param $data
  * @return static
  */
 public function DeleteProfile($data)
 {
     //dd($data);
     $check = $this->checkProfileExists($data->email);
     $profile_id = $this->getProfile($data->id);
     //dd($profile_id);
     if ($check != null) {
         $profile = Profile::find($profile_id);
         //dd($profile);
         $profile->delete();
         return;
     }
 }