Skip to content

Commit

Permalink
add event in home page and setting up a new set-up for event
Browse files Browse the repository at this point in the history
  • Loading branch information
sharbel93 committed Nov 11, 2019
1 parent f5314bd commit d2f6319
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 137 deletions.
7 changes: 5 additions & 2 deletions app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct()
*/
public function index()
{
$events = Event::orderBy('created','ASC')->get();
$events = Event::orderBy('created_At','ASC')->get();
return view('manage.events.index')->withEvents($events);
}

Expand Down Expand Up @@ -55,7 +55,10 @@ public function store(Request $request)
$event->title = $request->title;
$event->venue = $request->venue;
$event->location = $request->location;
$event->created = $request->created;
$event->start = $request->start;
$event->end = $request->end;
$event->host = $request->host;
$event->guest = $request->guest;
$event->content = Purifier::clean($request->content);

if( $request->hasFile('thumbnail') ) {
Expand Down
6 changes: 4 additions & 2 deletions app/Http/Controllers/ViewPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ class ViewPageController extends Controller
{
//different view pages of the website
public function getIndex() {
$eventss = Event::orderBy('id', 'desc')->take(3);
return view('pages.index')->withEvents($events);
// $events = Event::orderBy('id', 'desc')->take(3);
$events = Event::orderBy('start', 'desc')->get()->take(2);
$upcoming = Event::orderBy('start', 'asc')->get()->take(5);
return view('pages.index')->withEvents($events)->withUpcoming($upcoming);
}

public function getAbout() {
Expand Down
4 changes: 2 additions & 2 deletions database/migrations/2019_01_09_053002_create_events_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class CreateEventsTable extends Migration
{
/**
/**amp
* Run the migrations.
*
* @return void
Expand All @@ -19,7 +19,7 @@ public function up()
$table->string('venue');
$table->string('location');
$table->string('thumbnail');
$table->date('created');
// $table->date('created');
$table->longText('content');
$table->timestamps();
});
Expand Down
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 AddEventDatesToEventsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('events', function (Blueprint $table) {
// add events date
$table->date('start')->after('thumbnail');
$table->date('end')->after('start');
$table->string('guest')->after('location');
$table->string('host')->after('guest');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('events', function (Blueprint $table) {
//
$table->dropColumn('created');
});
}
}
1 change: 1 addition & 0 deletions resources/sass/_home.scss
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@

}


////////////////theme//////////

section{
Expand Down
7 changes: 6 additions & 1 deletion resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
<meta name="description"
content=" <strong>House of Grace Church - Eldoret<strong> was Launched on 16th January 2015. It is located
in Kapsoya, opposite The Noble Hotel,a few meters from the Nairobi – Eldoret Highway.">
<meta name="keywords" content="house of grace eldoret, house of grace, church eldoret, house of grace church
<meta name="keywor205.83ms4.39MBGET manage/posts/{post}web: [email protected]
5 statements were executed7.9ms
select * from `users` where `id` = '1' limit 1
3.42ms
/vendor/ds" content="house of grace eldoret, house of grace, church eldoret, house of grace church
eldoret, eldoret, church , Kenya, house of grace eldoret kenya">
<!-- Fonts -->
{{--<link rel="dns-prefetch" href="https://fonts.gstatic.com">--}}
Expand All @@ -36,6 +40,7 @@
<link rel="stylesheet" href="{{asset('css/bootstrap.min.css')}}">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display+SC" rel="stylesheet">
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
@yield('styles')
<script src="//platform-api.sharethis.com/js/sharethis.js#property=5c10b7c81c98570011922822&product=inline-share-buttons"></script>
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-128002808-1"></script>
Expand Down
101 changes: 62 additions & 39 deletions resources/views/manage/events/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,77 @@

<form action="{{ route('events.store') }}" method="post" enctype="multipart/form-data" >
{{ csrf_field()}}
<div class="col-md-6">
<div class="form-group">
<label for="title">Event Title</label>
<input type="text" class="form-control" id="title" name="title" placeholder="Event Title">
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label for="title">Event Title</label>
<input type="text" class="form-control" id="title" name="title" placeholder="Event Title">
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="venue">Event Venue</label>
<input type="text" class="form-control" id=" venue" name="venue"
placeholder="Event Venue">
<div class="col-lg-4">
<div class="form-group">
<label for="venue">Event Venue</label>
<input type="text" class="form-control" id=" venue" name="venue"
placeholder="Event Venue">
</div>
</div>
</div>

<div class="col-md-4">
<div class="form-group">
<label for="location">Event Location</label>
<input type="text" class="form-control" id="location" name="location"
placeholder="Event Location">
<div class="col-lg-4">
<div class="form-group">
<label for="location">Event Location</label>
<input type="text" class="form-control" id="location" name="location"
placeholder="Event Location">
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="created">Event Date</label>
<input type="date" class="form-control" id="created" name="created"
>
<div class="row">
<div class="col-lg-4">
<div class="form-group">
<label for="start">Event Start Date</label>
<input type="date" class="form-control" id="start" name="start"
>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="end">Event End Date</label>
<input type="date" class="form-control" id="end" name="end"
>
</div>
</div>
<div class="col-lg-4">
<div class="form-group">
<label for="guest">Guest</label>
<input type="text" class="form-control" id="guest" name="guest"
placeholder="Guest's name">
</div>
</div>
</div>
<div class="col-md-4">
<div class="row">
<div class="col-lg-6">
<div class="form-group">
<label for="by">By</label>
<input type="text" class="form-control" id="by" name="by"
placeholder="Author's name">
<label for="thumbnail">Upload Image</label>
<input type="file" class="form-control" id="thumbnail" name="thumbnail"
>
</div>
</div>


<div class="form-group">
<label for="thumbnail">Upload Image</label>
<input type="file" class="form-control" id="thumbnail" name="thumbnail"
>
<div class="col-lg-6">
<div class="form-group">
<label for="host">Host</label>
<input type="text" class="form-control" id="host" name="host"
placeholder="Host's name">
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="form-group">
<label for="content">Event Content</label>
<textarea type="text" class="form-control" id="content" name="content"
></textarea>
</div>
</div>
</div>

<div class="form-group">
<label for="content">Event Content</label>
<textarea type="text" class="form-control" id="content" name="content"
></textarea>
</div>
<button type="submit" class="btn btn-primary btn-block">Submit</button>
</form>
</div>
Expand All @@ -92,7 +115,7 @@
$(document).ready(function(){
$('#content').summernote({
height: 180,
placeholder: 'write your inspiration here ...',
placeholder: 'Event description ...',
toolbar: [
['style', ['style','bold', 'italic', 'underline', 'clear']],
['font', ['fontname','strikethrough', 'superscript', 'subscript']],
Expand All @@ -114,4 +137,4 @@
});
</script>
<script src="{{asset('/js/summernote.min.js')}}"></script>
@endsection
@endsection
27 changes: 21 additions & 6 deletions resources/views/manage/events/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

@section('styles')
<link rel="stylesheet" href="{{asset('/js/summernote.css')}}">

<style type="text/css">
</style>

@endsection

@section('content')
Expand Down Expand Up @@ -37,19 +43,28 @@
{{ Form::text('venue', null, ['class' => 'form-control form-control-lg'] ,
['placeholder' => '.form-control-lg']) }}

{{ Form::label('location', 'Event Location:') }}
{{ Form::label('location', 'Event Location:', ['class' => 'm-t-15']) }}
{{ Form::text('location', null, ['class' => 'form-control form-control-lg'] ,
['placeholder' => '.form-control-lg']) }}

{{ Form::label('created', 'Event Date', ['class' => 'm-t-15']) }}
{{ Form::date('created', null, ['class' => 'form-control form-control-lg']) }}
{{ Form::label('start', 'Event start Date', ['class' => 'm-t-15']) }}
{{ Form::date('start', null, ['class' => 'form-control form-control-lg']) }}

{{ Form::label('end', 'Event end Date', ['class' => 'm-t-15']) }}
{{ Form::date('end', null, ['class' => 'form-control form-control-lg']) }}

{{ Form::label('host', 'Event Host:', ['class' => 'm-t-15']) }}
{{ Form::text('host', null, ['class' => 'form-control form-control-lg'] , ['placeholder' => '.form-control-lg']) }}

{{ Form::label('guest', 'Event Guest:', ['class' => 'm-t-15']) }}
{{ Form::text('guest', null, ['class' => 'form-control form-control-lg'] , ['placeholder' => '.form-control-lg']) }}

{{ Form::label('thumbnail', 'Update Image',['class' => 'mb-2 my-2']) }}
{{ Form::file('thumbnail') }}
{{ Form::label('thumbnail', 'Update Image', ['class' => 'm-t-15 mb-2 my-2']) }}
{{ Form::file('thumbnail', ['class' => 'm-t-15']) }}
<img src="{{ asset('/events/images/'.$event->thumbnail) }}" alt="image">
<br>

{{ Form::label('content', 'Event Content:', ['class' => 'form-spacing-top']) }}
{{ Form::label('content', 'Event Content:', ['class' => 'm-t-15 form-spacing-top']) }}
{{ Form::textarea('content',null, ['class' => 'form-control']) }}

{{ Form::submit('Save Changes', ['class' => ' m-t-20 btn btn-success btn-block']) }}
Expand Down
13 changes: 7 additions & 6 deletions resources/views/manage/events/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<th scope="col">venue</th>
<th scope="col">location</th>
<th scope="col">thumbnail</th>
<th scope="col">content</th>
<th scope="col">time</th>
<th scope="col">start</th>
<th scope="col">end</th>
<th scope="col">manage</th>
</tr>
</thead>
Expand All @@ -47,10 +47,11 @@
</li>

</ul></td>
<td>{{ substr(strip_tags($event->content),0 , 50 ) }} {{ strlen
(strip_tags
($event->content)) > 50 ? "..." : "" }}</td>
<td>{{ date('M j, Y', strtotime($event->created )) }}</td>
{{-- <td>{{ substr(strip_tags($event->content),0 , 50 ) }} {{ strlen--}}
{{-- (strip_tags--}}
{{-- ($event->content)) > 50 ? "..." : "" }}</td>--}}
<td>{{ date('M j, Y', strtotime($event->start )) }}</td>
<td>{{ date('M j, Y', strtotime($event->end )) }}</td>

<td><a href="{{ route('events.show', $event->id) }}" class="btn
btn-info btn-sm btn-outline-info ">View</a>
Expand Down
Loading

0 comments on commit d2f6319

Please sign in to comment.