<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
$subDomain = 'api';
$app->get($subDomain.'/', function() use ($app) {
    return $app->version();
});

$app->get($subDomain.'/phpinfo', function() use ($app) {
    phpinfo();
});
$app->get($subDomain.'/hello', function() use ($app) {
  if (view()->exists('view_hello')) {
      return view('view_hello', ['name' => 'Gipipoy Sanchez']);
  }else {
    return 'view not found';
  }
});
//$app->options($subDomain.'/crm', 'CrmController@option');
$app->options($subDomain.'/crm/login', 'CrmController@option');
$app->options($subDomain.'/crm/{id}', 'CrmController@option');
$app->options($subDomain.'/crm/send/{type}', 'CrmController@option');

$app->get($subDomain.'/crm', 'CrmController@connect');
//$app->post($subDomain.'/crm', 'CrmController@connect');
$app->post($subDomain.'/crm/login', 'CrmController@login');
$app->post($subDomain.'/crm/send/{type}', 'CrmMailController@send');
$app->put($subDomain.'/crm/{id}', 'CrmController@save');