diff --git a/.idea/Newsletters.iml b/.idea/Newsletters.iml
deleted file mode 100644
index c956989..0000000
--- a/.idea/Newsletters.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/blade.xml b/.idea/blade.xml
deleted file mode 100644
index ddb9fb5..0000000
--- a/.idea/blade.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
deleted file mode 100644
index e7bedf3..0000000
--- a/.idea/copyright/profiles_settings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 73e02de..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 03eb973..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,266 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
- DEFINITION_ORDER
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1491833654325
-
-
- 1491833654325
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Http/Controllers/NewslettersAdminController.php b/src/Http/Controllers/NewslettersAdminController.php
index 4a3ddaa..3c67c12 100755
--- a/src/Http/Controllers/NewslettersAdminController.php
+++ b/src/Http/Controllers/NewslettersAdminController.php
@@ -22,10 +22,14 @@ public function index(Request $request)
($trash) ? $query->onlyTrashed() : '';
$search = [];
- $search['name'] = $request->input('name', '');
+ if(config('mnewsletters.fields.name') !== false) {
+ $search['name'] = $request->input('name', '');
+ }
$search['email'] = $request->input('email', '');
- ($search['name']) ? $query->where('name', 'LIKE', '%' . $search['name'] . '%') : '';
+ if(config('mnewsletters.fields.name') !== false) {
+ ($search['name']) ? $query->where('name', 'LIKE', '%' . $search['name'] . '%') : '';
+ }
($search['email']) ? $query->where('email', 'LIKE', '%' . $search['email'] . '%') : '';
$newsletters = $query->paginate(50);
@@ -37,40 +41,6 @@ public function index(Request $request)
return view('mixdinternet/newsletters::admin.index', $view);
}
- public function create(Newsletter $newsletter)
- {
- $view['newsletter'] = $newsletter;
- return view('mixdinternet/newsletters::admin.form', $view);
- }
-
- public function store(CreateEditNewslettersRequest $request)
- {
- if (Newsletter::create($request->all())) {
- Flash::success('Item inserido com sucesso.');
- } else {
- Flash::error('Falha no cadastro.');
- }
-
- return ($url = session()->get('backUrl')) ? redirect($url) : redirect()->route('admin.newsletters.index');
- }
-
- public function edit(Newsletter $newsletter)
- {
- $view['newsletter'] = $newsletter;
- return view('mixdinternet/newsletters::admin.form', $view);
- }
-
- public function update(Newsletter $newsletter, CreateEditNewslettersRequest $request)
- {
- if ($newsletter->update($request->all())) {
- Flash::success('Item atualizado com sucesso.');
- } else {
- Flash::error('Falha na atualização.');
- }
-
- return ($url = session()->get('backUrl')) ? redirect($url) : redirect()->route('admin.newsletters.index');
- }
-
public function destroy(Request $request)
{
if (Newsletter::destroy($request->input('id'))) {
@@ -104,10 +74,13 @@ public function download(Request $request)
$query = Newsletter::sort();
$search = [];
- $search['name'] = $request->input('name', '');
+ if(config('mnewsletters.fields.name') !== false) {
+ $search['name'] = $request->input('name', '');
+ }
$search['email'] = $request->input('email', '');
-
- ($search['name']) ? $query->where('name', 'LIKE', '%' . $search['name'] . '%') : '';
+ if(config('mnewsletters.fields.name') !== false) {
+ ($search['name']) ? $query->where('name', 'LIKE', '%' . $search['name'] . '%') : '';
+ }
($search['email']) ? $query->where('email', 'LIKE', '%' . $search['email'] . '%') : '';
$newsletters = $query->paginate(50);
@@ -119,12 +92,21 @@ public function download(Request $request)
$nameFile = "leads".$user_id.$date.".csv";
$csv = '';
- $csv .= "\"nome\";\"email\";\"data de cadastro\"\n";
+ if(config('mnewsletters.fields.name') !== false) {
+ $csv .= "\"nome\";\"email\";\"data de cadastro\"\n";
- foreach($newsletters as $row) {
- $csv .= "\"".$row['name']."\";\"".$row['email']."\";\"".Carbon::parse($row['created_at'])->format('d/m/Y H:i')."\"\n";
+ foreach ($newsletters as $row) {
+ $csv .= "\"" . $row['name'] . "\";\"" . $row['email'] . "\";\"" . Carbon::parse($row['created_at'])->format('d/m/Y H:i') . "\"\n";
+ }
}
+ if(config('mnewsletters.fields.name') == false){
+ $csv .= "\"email\";\"data de cadastro\"\n";
+
+ foreach ($newsletters as $row) {
+ $csv .= "\"" . $row['email'] . "\";\"" . Carbon::parse($row['created_at'])->format('d/m/Y H:i') . "\"\n";
+ }
+ }
$arquivo = $nameFile;
// Configurações header para forçar o download
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
diff --git a/src/Http/helpers.php b/src/Http/helpers.php
deleted file mode 100644
index f2854d7..0000000
--- a/src/Http/helpers.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
- {!! BootForm::horizontal(['model' => $newsletter, 'store' => 'admin.newsletters.store', 'update' => 'admin.newsletters.update'
- , 'id' => 'form-model', 'class' => 'form-horizontal form-rocket jq-form-validate jq-form-save'
- , 'files' => true ]) !!}
-
-
-
-
-
- @if ($newsletter['id'])
- {!! BootForm::text('id', 'Código', null, ['disabled' => true]) !!}
- @endif
- {!! BootForm::text('name', 'Nome', $newsletter->name, ['data-rule-required' => true, 'maxlength' => '150']) !!}
- {!! BootForm::text('email', 'Email', $newsletter->email, ['data-rule-required' => true, 'maxlength' => '150']) !!}
-
-
-
-
-
- {!! BootForm::close() !!}
-
-@endsection
\ No newline at end of file
diff --git a/src/resources/views/admin/index.blade.php b/src/resources/views/admin/index.blade.php
index c1b6030..5c29d5c 100755
--- a/src/resources/views/admin/index.blade.php
+++ b/src/resources/views/admin/index.blade.php
@@ -5,10 +5,6 @@
@endsection
@section('btn-insert')
- {{-- @if((!checkRule('admin.newsletters.create')) && (!$trash))
- @include('mixdinternet/admix::partials.actions.btn.insert', ['route' => route('admin.newsletters.create')])
- @endif
- --}}
@if((!checkRule('admin.newsletters.trash')) && (!$trash))
@include('mixdinternet/admix::partials.actions.btn.trash', ['route' => route('admin.newsletters.trash')])
@endif
@@ -27,9 +23,11 @@
{!! Form::model($search, ['route' => ($trash) ? 'admin.newsletters.trash' : 'admin.newsletters.index', 'method' => 'get', 'id' => 'form-search'
, 'class' => '']) !!}
-
- {!! BootForm::text('name', 'Nome') !!}
-
+ @if(config('mnewsletters.fields.name') !== false)
+
+ {!! BootForm::text('name', 'Nome') !!}
+
+ @endif
{!! BootForm::text('email', 'Email') !!}
@@ -38,7 +36,7 @@
-
+
Download
@@ -72,7 +70,9 @@ class="btn btn-default btn-flat">
@endif
{!! columnSort('#', ['field' => 'id', 'sort' => 'asc']) !!} |
-
{!! columnSort('Nome', ['field' => 'name', 'sort' => 'asc']) !!} |
+ @if(config('mnewsletters.fields.name') !== false)
+
{!! columnSort('Nome', ['field' => 'name', 'sort' => 'asc']) !!} |
+ @endif
{!! columnSort('Email', ['field' => 'email', 'sort' => 'asc']) !!} |
{!! columnSort('Data de cadastro', ['field' => 'created_at', 'sort' => 'asc']) !!} |
|
@@ -87,13 +87,12 @@ class="btn btn-default btn-flat">
@endif
{{ $newsletter->id }} |
-
{{ $newsletter->name }} |
+ @if (config('mnewsletters.fields.name') !== false)
+
{{ $newsletter->name }} |
+ @endif
{{ $newsletter->email }} |
{{ $newsletter->created_at->format('d/m/Y') }} |
- {{-- !!} @if((!checkRule('admin.newsletters.edit')) && (!$trash))
- @include('mixdinternet/admix::partials.actions.btn.edit', ['route' => route('admin.newsletters.edit', $newsletter->id)])
- @endif --}}
@if((!checkRule('admin.newsletters.destroy')) && (!$trash))
@include('mixdinternet/admix::partials.actions.btn.delete', ['route' => route('admin.newsletters.destroy'), 'id' => $newsletter->id])
@endif
diff --git a/src/routes/web.php b/src/routes/web.php
index b266c8a..41f6fc1 100755
--- a/src/routes/web.php
+++ b/src/routes/web.php
@@ -3,6 +3,7 @@
Route::group(['middleware' => ['auth.admin', 'auth.rules']], function () {
Route::get('newsletters/trash', ['uses' => 'NewslettersAdminController@index', 'as' => '.trash']);
Route::post('newsletters/restore/{id}', ['uses' => 'NewslettersAdminController@restore', 'as' => '.restore']);
+ Route::get('newsletters/download', ['uses' => 'NewslettersAdminController@download', 'as' => '.download']);
Route::resource('newsletters', 'NewslettersAdminController', [
'names' => [
'index' => '.index',
@@ -14,7 +15,7 @@
], 'except' => ['destroy']
]);
Route::delete('newsletters/destroy', ['uses' => 'NewslettersAdminController@destroy', 'as' => '.destroy']);
- Route::get('newsletters/download', ['uses' => 'NewslettersAdminController@download', 'as' => '.download']);
+
});
});
\ No newline at end of file
|