Created
December 23, 2016 07:40
-
-
Save segun6060/a7a57f7e3c1c982101850dc027098f2b to your computer and use it in GitHub Desktop.
my error are always in two form 1.Undefined variable: attendants (View: C:\wamp\www\rccg_app\resources\views\attendant.blade.php) or 2.trying to get property of non-object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Attendant extends Model { | |
// | |
// DEFINE RELATIONSHIPS -------------------------------------------------- | |
// each attendant HAS one day | |
protected $table = 'attendants'; | |
public function day() | |
{ | |
return $this->belongsTo('App\Days'); // this matches the Eloquent model | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@extends('main') | |
@section('stylesheet') | |
<link href="{{asset('css/smart-forms.css')}}" rel="stylesheet"> | |
@endsection | |
@section('title', '| Attendant') | |
@section('content') | |
@parent | |
<!-- START X-NAVIGATION VERTICAL --> | |
@include('partials._headbar') | |
<!-- END X-NAVIGATION VERTICAL --> | |
<!-- START BREADCRUMB --> | |
<!-- START BREADCRUMB --> | |
<ul class="breadcrumb"> | |
<li><a href="#">Home</a></li> | |
<li class="active">Dashboard</li> | |
</ul> | |
<!-- END BREADCRUMB --> | |
<!-- END BREADCRUMB --> | |
<!-- PAGE TITLE --> | |
<div class="page-title"> | |
<h2><span class="fa fa-arrow-circle-o-left"></span> Welcome Joe</h2> | |
<button class="btn btn-success dropdown-toggle pull-right" data-toggle="modal" data-target="#myModal"><i class="fa fa-plus"></i> Add Today Service</button> | |
</div> | |
<!-- END PAGE TITLE --> | |
<!-- PAGE CONTENT WRAPPER --> | |
<div class="page-content-wrap"> | |
<div class="row"> | |
<div class="col-md-12"> | |
<!-- START DATATABLE EXPORT --> | |
<div class="panel panel-default"> | |
<div class="panel-heading"> | |
<h3 class="panel-title">Church Weekly Activity Record : Attendant, Offering e.t.c</h3> | |
<div class="btn-group pull-right"> | |
<button class="btn btn-danger dropdown-toggle" data-toggle="dropdown"><i class="fa fa-bars"></i> Export Data</button> | |
<ul class="dropdown-menu"> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'txt',escape:'false'});"><img src='img/icons/txt.png' width="24"/> TXT</a></li> | |
<li class="divider"></li> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'excel',escape:'false'});"><img src='img/icons/xls.png' width="24"/> XLS</a></li> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'doc',escape:'false'});"><img src='img/icons/word.png' width="24"/> Word</a></li> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'powerpoint',escape:'false'});"><img src='img/icons/ppt.png' width="24"/> PowerPoint</a></li> | |
<li class="divider"></li> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'png',escape:'false'});"><img src='img/icons/png.png' width="24"/> PNG</a></li> | |
<li><a href="#" onClick ="$('#customers2').tableExport({type:'pdf',escape:'false'});"><img src='img/icons/pdf.png' width="24"/> PDF</a></li> | |
</ul> | |
</div> | |
</div> | |
<div class="panel-body"> | |
<table id="customers2" class="table datatable"> | |
<thead> | |
<tr> | |
<th>Preacher</th> | |
<th>Topic</th> | |
<th>Days</th> | |
<th>Men</th> | |
<th>Woman</th> | |
<th>Children</th> | |
<th>Total</th> | |
<th>Date</th> | |
</tr> | |
</thead> | |
<tbody> | |
@foreach ($attendants as $attendant) | |
<tr> | |
<td>{{$attendant->preacher}}</td> | |
<td>{{$attendant->topic}}</td> | |
<td>{{$attendant->days->name}}</td> | |
<td>{{$attendant->men}}</td> | |
<td>{{$attendant->women}}</td> | |
<td>{{$attendant->children}}</td> | |
<td>{{$attendant->total}}</td> | |
<td>{{$attendant->created_at}}</td> | |
</tr> | |
@endforeach | |
</tbody> | |
</table> | |
</div> | |
</div> | |
<!-- END DATATABLE EXPORT --> | |
</div> | |
</div> | |
</div> | |
<!-- END PAGE CONTENT WRAPPER --> | |
<!-- Modal --> | |
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | |
<div class="modal-dialog" role="document"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
<h4 class="modal-title" id="myModalLabel">Modal title</h4> | |
</div> | |
<div class="modal-body"> | |
<div class="smart-wrap"> | |
<div class="smart-forms smart-container wrap-2"> | |
<form method="post" action="" data-parsley-validate=""> | |
<input type="hidden" name="_token" value="{{ csrf_token() }}"> | |
<div class="form-body"> | |
<div class="spacer-b30"> | |
<div class="tagline"><span>Simple Cloning </span></div><!-- .tagline --> | |
</div> | |
<div class="cloneya-wrap"> | |
<div class="toclone "> | |
<div class="spacer-b10"> | |
<label class="field"> | |
<input class="gui-input" name="preacher" placeholder="Preacher Name" type="text" required="" minlength="3"> | |
</label> | |
</div> | |
</div> | |
</div><!-- end #clone-fields --> | |
<div class="spacer-b30 spacer-t30"> | |
<div class="tagline"><span>Group Cloning (MAX 5)</span></div><!-- .tagline --> | |
</div> | |
<div class="cloneya-wrap"> | |
<div class="toclone "> | |
<div class="frm-row"> | |
<div class="spacer-b10 colm colm6"> | |
<label class="prepend-icon"> | |
<input name="topic" class="gui-input" placeholder="Add Topic" type="text" required="" minlength="3"> | |
<span class="field-icon"><i class="fa fa-user"></i></span> | |
</label> | |
</div> | |
<div class="spacer-b10 colm colm6"> | |
<label class="field select1"> | |
<select name="day_category_id"> | |
{{-- @foreach ($day_categories as $daycategory) | |
<option value="{{$daycategory->name}}">{{$daycategory->name}}</option> | |
@endforeach --}} | |
</select> | |
<i class="arrow double"></i> | |
</label> | |
</div> | |
</div><!-- end frm-row section --> | |
</div> | |
</div><!-- end #clone-group-fields --> | |
<div class="spacer-b30 spacer-t30"> | |
<div class="tagline"><span>Animated with custom events</span></div><!-- .tagline --> | |
</div> | |
<div class="cloneya-wrap"> | |
<div class="toclone "> | |
<div class="frm-row"> | |
<div class="spacer-b10 colm colm6"> | |
<label class="prepend-icon"> | |
<input name="men" id="txt1" onkeyup="sum()"; autocomplete="off" class="gui-input" placeholder="Men" type="text" required="" data-parsley-type="number"> | |
<span class="field-icon"><i class="fa fa-male"></i></span> | |
</label> | |
</div> | |
<div class="spacer-b10 colm colm6"> | |
<label class="prepend-icon"> | |
<input name="woman" id="txt2" onkeyup="sum()"; autocomplete="off" class="gui-input" placeholder="Woman" type="text" required="" data-parsley-type="number"> | |
<span class="field-icon"><i class="fa fa-male"></i></span> | |
</label> | |
</div> | |
</div><!-- end frm-row section --> | |
</div> | |
</div><!-- end #clone-animate --> | |
<div class="cloneya-wrap"> | |
<div class="toclone "> | |
<div class="frm-row"> | |
<div class="spacer-b10 colm colm6"> | |
<label class="prepend-icon"> | |
<input name="children" id="txt3" onkeyup="sum()"; autocomplete="off" class="gui-input" placeholder="Children" type="text" required="" data-parsley-type="number"> | |
<span class="field-icon"><i class="fa fa-male"></i></span> | |
</label> | |
</div> | |
<div class="spacer-b10 colm colm6"> | |
<label class="prepend-icon"> | |
<input name="total" id="txt4" autocomplete="off" class="gui-input" placeholder="Total" type="text" required="" data-parsley-type="number"> | |
<span class="field-icon"><i class="fa fa-users"></i></span> | |
</label> | |
</div> | |
</div><!-- end frm-row section --> | |
</div> | |
</div><!-- end #clone-animate --> | |
</div><!-- end .form-body section --> | |
<div class="form-footer"> | |
<button type="submit" class="button btn-primary"> Send</button> | |
</div><!-- end .form-footer section --> | |
</form> | |
</div><!-- end .smart-forms section --> | |
</div><!-- end .smart-wrap section --> | |
</div> | |
<div class="modal-footer"> | |
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> | |
<button type="button" class="btn btn-primary">Save changes</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
@endsection | |
@section('scripts') | |
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\Http\Requests; | |
use App\Http\Controllers\Controller; | |
use App\Attendant; | |
use Illuminate\Http\Request; | |
class attendantController extends Controller { | |
public function atshow() | |
{ | |
} | |
/** | |
* Display a listing of the resource. | |
* | |
* @return Response | |
*/ | |
public function index() | |
{ | |
// | |
$attendants = Attendant::all(); | |
return View('attendant')->with('Attendants', $attendants); | |
} | |
/** | |
* Show the form for creating a new resource. | |
* | |
* @return Response | |
*/ | |
public function create() | |
{ | |
// | |
} | |
/** | |
* Store a newly created resource in storage. | |
* | |
* @return Response | |
*/ | |
public function store() | |
{ | |
// | |
} | |
/** | |
* Display the specified resource. | |
* | |
* @param int $id | |
* @return Response | |
*/ | |
public function show($id) | |
{ | |
// | |
} | |
/** | |
* Show the form for editing the specified resource. | |
* | |
* @param int $id | |
* @return Response | |
*/ | |
public function edit($id) | |
{ | |
// | |
} | |
/** | |
* Update the specified resource in storage. | |
* | |
* @param int $id | |
* @return Response | |
*/ | |
public function update($id) | |
{ | |
// | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param int $id | |
* @return Response | |
*/ | |
public function destroy($id) | |
{ | |
// | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class Days extends Model { | |
// | |
// DEFINE RELATIONSHIPS -------------------------------------------------- | |
// each day belong to many attendant | |
public function attendant() | |
{ | |
return $this->hasMany('App\Attendant'); // this matches the Eloquent model | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment