Example #1
0
        if ($agent->phone_one_name == 'Cell') {
            $mobile = $agent->phone_one;
        }
        if ($agent->phone_two_name == 'Cell') {
            $mobile = $agent->phone_two;
        }
        $existing_agent = \App\Agents::find($agent->agent_id);
        if (!$existing_agent) {
            $last_agent = \App\Agents::orderBy('agent_order')->get()->last();
            if (!$last_agent) {
                $order = 1;
            } else {
                $order = $last_agent->agent_order + 1;
            }
            //dd($last_agent);
            \App\AgentData::create(['zip' => $agent->zip, 'source' => 'O', 'agent_id' => $agent->agent_id]);
            \App\Agents::create(['id' => $agent->agent_id, 'first_name' => $agent->first_name, 'last_name' => $agent->last_name, 'agent_full_name' => $agent->last_name . ', ' . $agent->first_name, 'email_address' => $agent->email, 'mobile_phone' => $mobile, 'office_phone' => $agent->phone_one, 'office' => $agent->address1, 'photo' => $agent->photo, 'agent_order' => $order]);
        }
    }
    return redirect('admin');
});
// Helper routes
/**
*Image manipulation
*/
Route::get('img/{path}', function (League\Glide\Server $server, \Illuminate\Http\Request $request) {
    $server->outputImage($request);
})->where('path', '.*');
/**
*
*/