Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/Feature.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Feature extends Model
{
protected $fillable = [
'event_id',
'title',
'content',
'extra',
'visible',
'icon'
];
public function event(){
return $this->belongsTo(Event::class);
}
}
57 changes: 57 additions & 0 deletions app/Http/Controllers/Admin/FeatureController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace App\Http\Controllers\Admin;

use App\Feature;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class FeatureController extends Controller
{
//
public function __construct()
{
$this->middleware('auth');
}

/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function list($id)
{
$feature = Feature::where('event_id', $id)->orderBy('id','DESC')->paginate(10);
return response()->json($feature, 201);
}

/** Delete Feature */
public function destroy($id)
{
$feature = Feature::destroy($id);
return response()->json($feature);
}

/** Create Feature */
public function store(Request $request)
{
$values = $request;
$feature = Feature::create([
'event_id' => $values['event_id'],
'title' => $values['title'],
'content' => $values['content'],
'extra' => $values['extra'],
'visible' => $values['visible'],
'icon' => $values['icon']
]);
return response()->json($feature);
}

/** Update Feature */
public function update(Request $request, $id)
{
$feature = Feature::find($id)->update($request->all());
return response()->json($feature);
}

}
37 changes: 37 additions & 0 deletions database/migrations/2019_10_08_161355_create_features_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFeaturesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('features', function (Blueprint $table) {
$table->increments('id');
$table->integer('event_id')->unsigned();
$table->string('feature_title', 250);
$table->mediumText('feature_content')->nullable();
$table->mediumText('feature_extra')->nullable();
$table->boolean('feature_visible');
$table->string('feature_icon', 250);
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('features');
}
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"gijgo": "^1.9.13",
"jquery": "^3.2",
"laravel-mix": "^4.0.7",
"lodash": "^4.17.5",
"lodash": "^4.17.13",
"popper.js": "^1.12",
"resolve-url-loader": "^2.3.1",
"sass": "^1.22.2",
Expand Down
4 changes: 4 additions & 0 deletions public/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -13872,3 +13872,7 @@ a.text-dark:focus {
box-shadow: 10px 5px 5px 1px #cdcdcd;
}

.add-feature {
padding: 1rem 0.5rem;
}

3 changes: 3 additions & 0 deletions resources/sass/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,7 @@ $fa-font-path: "~font-awesome/fonts";
}
.tool:hover{
box-shadow: 10px 5px 5px 1px #cdcdcd;
}
.add-feature{
padding: 1rem .5rem;
}
7 changes: 6 additions & 1 deletion resources/views/event/partials/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@
<small class="form-text text-muted">Subir una imagen debe ser de 600 x 144 pixeles .</small>
</div>
@endif

<div class="add-feature">
<button type="button" class="btn btn-block btn-success" data-toggle="modal" data-target="#features_create">
<i class="fas fa-plus"></i> {{ __('Add feature') }}
</button>
</div>
</div>
</div>
<div class="row">
Expand All @@ -212,3 +216,4 @@
</div>
</div>
</div>
@include('feature.create')
50 changes: 50 additions & 0 deletions resources/views/feature/create.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!-- Modal Register Billings -->
<div class="modal fade" id="features_create" tabindex="-1" role="dialog" aria-labelledby="features_create" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<form id="formFeature" class="form-horizontal" method="POST" >
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="features_modal">{{ __('Add feature') }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">

{{ Form::hidden('event_id', '',['id' => 'event_id']) }}

<div class="form-group">
{{ Form::label('feature_title', 'Título de característica') }}
{{ Form::text('feature_title', null, ['class' => 'form-control', 'id' => 'feature_title']) }}
</div>

<div class="form-group">
{{ Form::label('feature_icon', 'Icono') }}
{{ Form::text('feature_icon', null, ['class' => 'form-control', 'id' => 'feature_icon']) }}
</div>

<div class="form-group">
{{ Form::label('feature_content', 'Descripción') }}
{{ Form::textarea('feature_content', null, ['class' => 'form-control ckeditor', 'id' => 'feature_content']) }}
</div>


{{--
<div class="form-group">
{{ Form::label('business_name', 'Razón social') }}
{{ Form::text('business_name', null, ['class' => 'form-control', 'id' => 'business_name', 'v-model' => 'billings.business_name']) }}
</div>
<div class="form-group">
{{ Form::label('fiscal_address', 'Dirección fiscal') }}
{{ Form::text('fiscal_address', null, ['class' => 'form-control', 'id' => 'fiscal_address' , 'v-model' => 'billings.fiscal_address']) }}
</div>--}}

</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ __('Close') }}</button>
<button type="submit" class="btn btn-primary">{{ __('Save changes') }}</button>
</div>
</div>
</form>
</div>
</div>
7 changes: 7 additions & 0 deletions resources/views/feature/edit.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
/**
* Created by PhpStorm.
* User: aragonc
* Date: 08/10/19
* Time: 08:58 PM
*/
6 changes: 6 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});

//Route Feature
Route::get('/feature/list/{slug}','Admin\FeatureController@list')->name('list');
Route::delete('/feature/{slug}','Admin\FeatureController@destroy')->name('delete');
Route::post('/feature','Admin\FeatureController@store')->name('store');
Route::post('/feature/{slug}','Admin\FeatureController@update')->name('update');