Active / inactive sponsors
This commit is contained in:
parent
7853d1411f
commit
505599251e
|
|
@ -143,6 +143,7 @@ class EventSponsorController extends MyBaseController
|
|||
'name' => 'required|max:250',
|
||||
'sponsor_logo' => 'image',
|
||||
'on_ticket' => 'boolean',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
$validator = Validator::make($request->all(), $rules);
|
||||
|
|
@ -173,6 +174,7 @@ class EventSponsorController extends MyBaseController
|
|||
}
|
||||
|
||||
$sponsor->on_ticket = $request->has('on_ticket');
|
||||
$sponsor->is_active = $request->has('is_active');
|
||||
$sponsor->name = $request->get('name');
|
||||
|
||||
$sponsor->save();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ namespace App\Models;
|
|||
*/
|
||||
class Sponsor extends \Illuminate\Database\Eloquent\Model
|
||||
{
|
||||
|
||||
/**
|
||||
* Get the full logo path of the sponsor.
|
||||
*
|
||||
|
|
@ -20,4 +19,9 @@ class Sponsor extends \Illuminate\Database\Eloquent\Model
|
|||
|
||||
return config('attendize.fallback_organiser_logo_url');
|
||||
}
|
||||
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddActiveToSponsors extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('sponsors', function($table){
|
||||
$table->boolean('is_active')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('sponsors', function($table){
|
||||
$table->dropColumn('is_active');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,16 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="well well-sm well-small">
|
||||
{!! Form::label('is_active', 'Active?', array('class'=>'control-label ')) !!}
|
||||
{!! Form::checkbox('is_active', 1, $sponsor->is_active) !!}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,6 @@
|
|||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
{{-- New Sponsor Form --}}
|
||||
{{-- Edit Sponsor onClick --}}
|
||||
{{-- Delete Sponsor --}}
|
||||
|
||||
{{-- Show Sponsors --}}
|
||||
<div class="col-md-12">
|
||||
<div class="panel">
|
||||
<div class="table-responsive">
|
||||
|
|
@ -53,7 +48,8 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th colspan="2">On Ticket</th>
|
||||
<th>On Ticket</th>
|
||||
<th colspan="2">Active</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
@ -63,6 +59,7 @@
|
|||
<a href='javascript:void(0);' data-modal-id='view-sponsor-{{ $sponsor->id }}' data-href="{{route('showEditSponsor', ['event_id'=>$event->id, 'sponsor_id' => $sponsor->id])}}" class="loadModal">{{ $sponsor->name }}</a>
|
||||
</td>
|
||||
<td>{{ $sponsor->on_ticket ? 'Yes' : 'No' }}</td>
|
||||
<td>{{ $sponsor->is_active ? 'Yes' : 'No' }}</td>
|
||||
<td>
|
||||
{!! Form::open(array('url' => route('postDeleteSponsor', ['event_id' => $event->id, 'sponsor_id' => $sponsor->id]), 'class' => 'ajax text-right')) !!}
|
||||
{!! Form::submit('Delete Sponsor', ['class'=>"btn btn-danger"]) !!}
|
||||
|
|
|
|||
Loading…
Reference in New Issue