public function store(Request $request)
 {
     $validator = \Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email']);
     if ($validator->fails()) {
         return json_encode(['fails' => true, 'messages' => $validator->messages()]);
     } else {
         $lead = new \App\Lead();
         $lead->first_name = $request->get('first_name');
         $lead->last_name = $request->get('last_name');
         $lead->email = $request->get('email');
         $lead->phone = $request->get('phone');
         $lead->message = $request->get('message');
         $lead->community_id = $request->get('community_id');
         if ($lead->save()) {
             $manager = \App\CommunityManager::where('iCommunityId', '=', $lead->community_id)->first();
             $this->sendNotificationEmail($lead, $manager->vEmail);
             return json_encode(['fails' => false]);
         } else {
             return json_encode(['fails' => true, 'messages' => 'Something went wrong inserting data into database.']);
         }
     }
 }
示例#2
0
@extends('layouts.leads', ['page' => 'Manage employees'])

@section('content')
	<?php 
$waiting_leads = App\Lead::where('user_id', '=', Auth::user()->id)->where('call', '=', false)->count();
?>
  <div class="row">
  	<div class="col-md-12">
      <table class="table table-bordered">
        <thead>
          <tr>
            <th>#</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Waiting Leads</th>
            <th>Remove Leads</th>
            <td>Add Leads</td>
          </tr>
        </thead>
        <tbody>
          @foreach($users as $user)
            <tr>
              <td>{{$user->id}}</td>
              <td>{{$user->firstname}}</td>
              <td>{{$user->lastname}}</td>
              <td>{{ App\Lead::where('user_id', '=', $user->id)->where('call', '=', false)->count() }}</td>
              <th><a href="{{Config::get('app.url')}}/leads/remove/{{$user->id}}" class="btn btn-danger">Remove Waiting Leads</a></th>
              <th><button type="button" data-toggle="modal" data-target="#addLeads{{$user->id}}" class="btn btn-info">Add Leads</button></th>
				<!-- Modal -->
				<div class="modal fade" id="addLeads{{$user->id}}" tabindex="-1" role="dialog" aria-labelledby="addLeadsLabel{{$user->id}}">
				  <div class="modal-dialog" role="document">
示例#3
0
    return $doctor->locations;
});
Route::get('timeslot/{location_id}/daysofweek', function ($location_id) {
    $daysOfWeek = \App\Timeslot::select('day')->where('location_id', $location_id)->groupBy('day')->lists('day')->toArray();
    $fullDaysOfWeek = ["0", "1", "2", "3", "4", "5", "6"];
    return array_diff($fullDaysOfWeek, $daysOfWeek);
});
Route::get('timeslot/location/{location_id}/dayofweek/{day}', function ($location_id, $day) {
    $timeslots = \App\Timeslot::select('time')->where('location_id', $location_id)->where('day', $day)->lists('time');
    return $timeslots;
});
use App\LeadUnload;
// set lead active to 0
Route::get('lead/{lead}/inactive', function ($lead) {
    $lead->active = 0;
    $lead->save();
    // send pusher event
    event(new LeadUnload($lead));
    return 'done';
});
Route::get('{lead_id}/retrieve_notes', ['as' => 'retrieve_notes_by_lead', 'uses' => 'NoteController@retrieveNote']);
get('{lead_id}/disposition_history', ['as' => 'disposition_lead_history', 'uses' => 'LeadController@getDispositionHistory']);
get('leads/success', ['as' => 'success_leads', 'uses' => 'LeadController@getSuccessLeads']);
get('patient/{query}', function ($query) {
    $json = [];
    $patients = App\Lead::where('name', 'LIKE', '%' . $query . '%')->orWhere('phone_no', 'LIKE', '%' . $query . '%')->orWhere('patient_no', 'LIKE', '%' . $query . '%')->get();
    foreach ($patients as $patient) {
        $json['items'][] = array('title' => $patient->name, 'description' => $patient->patient_no . '&nbsp; &squf; &nbsp;' . $patient->address, 'html_url' => route('lead.show', $patient->id));
    }
    return $json;
});