Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
crmforms-onestartup
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angel Martin
crmforms-onestartup
Commits
c1a8ccb6
Commit
c1a8ccb6
authored
Aug 29, 2018
by
Francisco Salazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detalles de session en interesado
parent
d8cd48e0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
154 additions
and
5 deletions
+154
-5
README.md
README.md
+26
-0
CrmFormsServiceProvider.php
src/CrmFormsServiceProvider.php
+4
-0
cronometro.js
src/assets/cronometro.js
+12
-0
CrmFormsController.php
src/controllers/CrmFormsController.php
+54
-1
2018_08_29_001921_create_interested_details_table.php
...ons/2018_08_29_001921_create_interested_details_table.php
+39
-0
InterestedDetail.php
src/model/InterestedDetail.php
+16
-0
form_base.blade.php
src/views/public/forms/form_base.blade.php
+3
-4
No files found.
README.md
View file @
c1a8ccb6
...
@@ -28,3 +28,28 @@ php artisan vendor:publish --provider="Onestartup\CrmForms\CrmFormsServiceProvid
...
@@ -28,3 +28,28 @@ php artisan vendor:publish --provider="Onestartup\CrmForms\CrmFormsServiceProvid
```
php
```
php
php
artisan
vendor
:
publish
--
tag
=
config
php
artisan
vendor
:
publish
--
tag
=
config
```
```
-
run command for publish assets
```
php
php
artisan
vendor
:
publish
--
tag
=
public
```
-
add next lines to app/Interested.php
```
php
public
function
interested_detail
(){
return
$this
->
hasOne
(
'Onestartup\CrmForms\Model\InterestedDetail'
,
'interested_id'
);
}
```
-
include form in your landing page
```
php
@
include
(
'crmforms-public::forms.form_base'
)
```
-include scripts in your landing page
```
php
<script
src=
"{{asset('assets/cronometro.js')}}"
type=
"text/javascript"
/>
```
\ No newline at end of file
src/CrmFormsServiceProvider.php
View file @
c1a8ccb6
...
@@ -29,6 +29,10 @@ class CrmFormsServiceProvider extends ServiceProvider
...
@@ -29,6 +29,10 @@ class CrmFormsServiceProvider extends ServiceProvider
}
}
$this
->
publishes
([
$this
->
publishes
([
__DIR__
.
'/assets'
=>
public_path
(
'assets'
),
],
'public'
);
$this
->
publishes
([
__DIR__
.
'/views/public'
=>
resource_path
(
'views/vendor/onestartup/crmforms'
),
__DIR__
.
'/views/public'
=>
resource_path
(
'views/vendor/onestartup/crmforms'
),
]);
]);
...
...
src/assets/cronometro.js
0 → 100644
View file @
c1a8ccb6
var
start
;
var
finish
;
jQuery
(
document
).
ready
(
function
(
$
)
{
start
=
new
Date
();
});
jQuery
(
"#landing_form"
).
submit
(
function
(
$
){
finish
=
new
Date
();
var
tiempo
=
(
+
finish
-
+
start
)
/
1000
;
jQuery
(
"#landing_form"
).
append
(
'<input type="hidden" name="session_time" value="'
+
tiempo
+
'" />'
);
});
\ No newline at end of file
src/controllers/CrmFormsController.php
View file @
c1a8ccb6
...
@@ -12,14 +12,40 @@ use App\Notifications\NewInterestd;
...
@@ -12,14 +12,40 @@ use App\Notifications\NewInterestd;
use
App\Notifications\EmailInvalid
;
use
App\Notifications\EmailInvalid
;
use
App\Interested
;
use
App\Interested
;
use
App\User
;
use
App\User
;
use
Jenssegers\Agent\Agent
;
use
Onestartup\CrmForms\Model\InterestedDetail
;
class
CrmFormsController
extends
Controller
class
CrmFormsController
extends
Controller
{
{
public
function
store
(
RequestInterested
$request
)
public
function
store
(
RequestInterested
$request
)
{
{
$user
=
User
::
find
(
1
);
$request
;
$agent
=
new
Agent
();
$agent
->
setUserAgent
(
$request
->
header
(
'User-Agent'
));
$browser
=
$agent
->
browser
();
$browser_version
=
$agent
->
version
(
$browser
);
$devise
=
$agent
->
device
();
$platform
=
$agent
->
platform
();
$platform_version
=
$agent
->
version
(
$platform
);
$session_time
=
$request
->
session_time
;
if
(
$agent
->
isMobile
()){
$devise_type
=
"Mobil"
;
}
elseif
(
$agent
->
isTablet
()){
$devise_type
=
"Tablet"
;
}
elseif
(
$agent
->
isDesktop
()){
$devise_type
=
"Desktop"
;
}
else
{
$devise_type
=
"Otro"
;
}
$agent
->
isMobile
();
$agent
->
isTablet
();
$user
=
User
::
find
(
1
);
if
(
config
(
'crmforms.validate_email'
))
{
//Se activa la opcion de validar emails por API
if
(
config
(
'crmforms.validate_email'
))
{
//Se activa la opcion de validar emails por API
...
@@ -35,6 +61,20 @@ class CrmFormsController extends Controller
...
@@ -35,6 +61,20 @@ class CrmFormsController extends Controller
$interested
->
notify
(
new
WelcomeInterested
());
$interested
->
notify
(
new
WelcomeInterested
());
$user
->
notify
(
new
NewInterestd
(
$interested
));
$user
->
notify
(
new
NewInterestd
(
$interested
));
$interested_details
=
InterestedDetail
::
firstOrNew
([
'interested_id'
=>
$interested
->
id
]);
$interested_details
->
browser
=
$browser
;
$interested_details
->
browser_version
=
$browser_version
;
$interested_details
->
devise
=
$devise
;
$interested_details
->
platform
=
$platform
;
$interested_details
->
platform_version
=
$platform_version
;
$interested_details
->
session_time
=
$session_time
;
$interested_details
->
devise_type
=
$devise_type
;
$interested_details
->
save
();
}
else
{
// Si el correo no es valido
}
else
{
// Si el correo no es valido
$user
->
notify
(
new
EmailInvalid
(
$request
->
all
()));
$user
->
notify
(
new
EmailInvalid
(
$request
->
all
()));
...
@@ -53,6 +93,19 @@ class CrmFormsController extends Controller
...
@@ -53,6 +93,19 @@ class CrmFormsController extends Controller
$interested
=
Interested
::
create
(
$request
->
all
());
$interested
=
Interested
::
create
(
$request
->
all
());
$interested
->
notify
(
new
WelcomeInterested
());
$interested
->
notify
(
new
WelcomeInterested
());
$user
->
notify
(
new
NewInterestd
(
$interested
));
$user
->
notify
(
new
NewInterestd
(
$interested
));
$interested_details
=
InterestedDetail
::
firstOrNew
([
'interested_id'
=>
$interested
->
id
]);
$interested_details
->
browser
=
$browser
;
$interested_details
->
browser_version
=
$browser_version
;
$interested_details
->
devise
=
$devise
;
$interested_details
->
plataform
=
$platform
;
$interested_details
->
plataform_version
=
$platform_version
;
$interested_details
->
session_time
=
$session_time
;
$interested_details
->
devise_type
=
$devise_type
;
$interested_details
->
save
();
}
}
...
...
src/migrations/2018_08_29_001921_create_interested_details_table.php
0 → 100644
View file @
c1a8ccb6
<?php
use
Illuminate\Support\Facades\Schema
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Database\Migrations\Migration
;
class
CreateInterestedDetailsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'interested_details'
,
function
(
Blueprint
$table
)
{
$table
->
increments
(
'id'
);
$table
->
integer
(
'interested_id'
)
->
unsigned
();
$table
->
string
(
'browser'
)
->
nullable
();
$table
->
string
(
'browser_version'
)
->
nullable
();
$table
->
string
(
'devise'
)
->
nullable
();
$table
->
string
(
'devise_type'
)
->
nullable
();
$table
->
string
(
'platform'
)
->
nullable
();
$table
->
string
(
'platform_version'
)
->
nullable
();
$table
->
double
(
'session_time'
,
8
,
2
)
->
nullable
();
$table
->
timestamps
();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'interested_details'
);
}
}
src/model/InterestedDetail.php
0 → 100644
View file @
c1a8ccb6
<?php
namespace
Onestartup\CrmForms\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
InterestedDetail
extends
Model
{
protected
$table
=
'interested_details'
;
protected
$fillable
=
[
"interested_id"
,
"browser"
,
"browser_version"
,
"devise"
,
"platform"
,
"platform_version"
,
"session_time"
];
public
function
interested
(){
return
$this
->
belongsTo
(
'App/Interested'
,
'interested_id'
);
}
}
\ No newline at end of file
src/views/public/forms/form_base.blade.php
View file @
c1a8ccb6
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
@
include
(
'partials.messages_partial'
)
@
include
(
'partials.messages_partial'
)
{{
--
No
remover
--
}}
{{
--
No
remover
--
}}
{
!!
Form
::
open
([
'route'
=>
[
'crmforms.store'
],
"method"
=>
"POST"
])
!!
}
{
!!
Form
::
open
([
'route'
=>
[
'crmforms.store'
],
"method"
=>
"POST"
,
"id"
=>
"landing_form"
])
!!
}
{
!!
Form
::
hidden
(
'landing'
,
(
Request
::
path
()
!=
'/'
?
Request
::
path
()
:
'inicio'
)
)
!!
}
{
!!
Form
::
hidden
(
'landing'
,
(
Request
::
path
()
!=
'/'
?
Request
::
path
()
:
'inicio'
)
)
!!
}
@
if
(
isset
(
$_GET
[
"_rdr"
]))
@
if
(
isset
(
$_GET
[
"_rdr"
]))
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
{
!!
Form
::
hidden
(
'origin'
,
'ninguno'
)
!!
}
{
!!
Form
::
hidden
(
'origin'
,
'ninguno'
)
!!
}
@
endif
@
endif
{{
--
***********
--
}}
{{
--
***********
--
}}
dsasd
<
div
class
="
row
">
<
div
class
="
row
">
<div class="
col
-
md
-
6
">
<div class="
col
-
md
-
6
">
{!! Form::label('name', 'Nombre', ['class'=>'']) !!}
{!! Form::label('name', 'Nombre', ['class'=>'']) !!}
...
@@ -40,4 +40,4 @@
...
@@ -40,4 +40,4 @@
{{-- No remover --}}
{{-- No remover --}}
{!! Form::close() !!}
{!! Form::close() !!}
{{-- **********] --}}
{{-- **********] --}}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment