Skip to content

Instantly share code, notes, and snippets.

@segun6060
Created December 23, 2016 13:37
Show Gist options
  • Save segun6060/2efbb877f7664d292cb2361751118741 to your computer and use it in GitHub Desktop.
Save segun6060/2efbb877f7664d292cb2361751118741 to your computer and use it in GitHub Desktop.
<?php namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Attendant;
use App\Days;
use Session;
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();
// dd( $attendants);
return view('attendant')->with('attendants', $attendants);
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
$days = Days::all();
// dd($day);
return view('attendant')->with('days', $days);
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
//
$this->validate($request, array(
'preacher' => 'required|max:255',
'topic' => 'required',
'days_id' => 'required',
'men' => 'required|integer',
'women' => 'required|integer',
'children' => 'required|integer',
'total' => 'required|integer',
));
$attendant = new attendant_book;
$attendant->preacher = $request->preacher;
$attendant->topic = $request->topic;
$attendant->days_id = $request->days_id;
$attendant->men = $request->men;
$attendant->women = $request->woman;
$attendant->children = $request->children;
$attendant->total = $request->total;
$attendant_book->save();
Session::flash('success','The data was succesfully save!');
return redirect()->route('attendant.index');
}
/**
* 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)
{
//
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment