updated commit

This commit is contained in:
sujitprasad
2015-05-08 16:25:40 +05:30
parent ef834c58dc
commit 267467725e
73 changed files with 2748 additions and 2938 deletions

View File

@@ -1,98 +1,80 @@
<?php namespace App\Http\Controllers\Admin;
use App\Http\Requests;
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/* Include Forms Model */
use App\Http\Requests\FormRequest;
use App\Model\Manage\Forms;
/* Include Form_visibility model */
use App\Model\Utility\Form_type;
use App\Model\Utility\Form_visibility;
/* Include Form_type model */
use App\Model\Utility\Form_type;
/* Include FormRequest for validation */
use App\Http\Requests\FormRequest;
/**
* FormController
*
* @package Controllers
* @subpackage Controller
* @author Ladybird <info@ladybirdweb.com>
*/
class FormController extends Controller {
/* constructor for authentication */
public function __construct()
{
/**
* Create a new controller instance.
* @return type void
*/
public function __construct() {
$this->middleware('auth');
$this->middleware('roles');
}
/**
* Display a listing of the resource.
*
* @return Response
* @param type Forms $form
* @return type Response
*/
public function index(Forms $form)
{
try
{
public function index(Forms $form) {
try {
/* declare variable $forms to hold the values of table form */
$forms = $form->get();
/* Direct to index page with Form table values */
return view('themes.default1.admin.manage.form.index',compact('forms'));
}
catch(Exception $e)
{
return view('themes.default1.admin.manage.form.index', compact('forms'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Show the form for creating a new resource.
*
* @return Response
* @param type Form_visibility $visibility
* @param type Form_type $type
* @return type Response
*/
public function create(Form_visibility $visibility, Form_type $type)
{
try
{
public function create(Form_visibility $visibility, Form_type $type) {
try {
/* Direct to Create page */
return view('themes.default1.admin.manage.form.create',compact('visibility','type'));
}
catch(Exception $e)
{
return view('themes.default1.admin.manage.form.create', compact('visibility', 'type'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Store a newly created resource in storage.
*
* @return Response
* @param type Forms $form
* @param type FormRequest $request
* @return type Response
*/
public function store(Forms $form, FormRequest $request)
{
try
{
public function store(Forms $form, FormRequest $request) {
try {
/* Fill the all request to the Table */
/* Checking Whether function Success or not */
if($form->fill($request->input())->save()==true)
{
if ($form->fill($request->input())->save() == true) {
/* Redirect to Index page with Success Message */
return redirect('form')->with('success','Form Created Successfully');
}
else
{
return redirect('form')->with('success', 'Form Created Successfully');
} else {
/* Redirect to Index page with Fail Message */
return redirect('form')->with('fails','Form can not Create');
return redirect('form')->with('fails', 'Form can not Create');
}
}
catch(Exception $e)
{
} catch (Exception $e) {
/* Redirect to Index page with Fail Message */
return redirect('form')->with('fails','Form can not Create');
return redirect('form')->with('fails', 'Form can not Create');
}
}
@@ -102,97 +84,78 @@ class FormController extends Controller {
* @param int $id
* @return Response
*/
public function show($id)
{
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
* @param type int $id
* @param type Forms $form
* @param type Form_visibility $visibility
* @param type Form_type $type
* @return type Response
*/
public function edit($id, Forms $form, Form_visibility $visibility, Form_type $type)
{
try
{
public function edit($id, Forms $form, Form_visibility $visibility, Form_type $type) {
try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
/* Direct to Edit page with Form table's perticular row using Id */
return view('themes.default1.admin.manage.form.edit',compact('forms','visibility','type'));
}
catch(Exception $e)
{
return view('themes.default1.admin.manage.form.edit', compact('forms', 'visibility', 'type'));
} catch (Exception $e) {
return view('404');
}
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
* @param type int $id
* @param type Forms $form
* @param type FormRequest $request
* @return type Response
*/
public function update($id, Forms $form, FormRequest $request)
{
try
{
public function update($id, Forms $form, FormRequest $request) {
try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
/* Fill the values to the row of a selected, by Id */
/* Check Whether function is Success or not */
if($forms->fill($request->input())->save()==true)
{
if ($forms->fill($request->input())->save() == true) {
/* redirect to Index page with Success Message */
return redirect('form')->with('success','Form Updated Successfully');
}
else
{
return redirect('form')->with('success', 'Form Updated Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('form')->with('fails','Form can not Update');
return redirect('form')->with('fails', 'Form can not Update');
}
}
catch(Exception $e)
{
} catch (Exception $e) {
/* Redirect to Index page with Fail Message */
return redirect('form')->with('fails','Form can not Create');
return redirect('form')->with('fails', 'Form can not Create');
}
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
* @param type int $id
* @param type Forms $form
* @return type Response
*/
public function destroy($id, Forms $form)
{
try
{
public function destroy($id, Forms $form) {
try {
/* declare variable $forms to hold the values of a row by Id */
$forms = $form->whereId($id)->first();
/* Delete the values to the row of a selected, by Id */
/* Check whether the fuction success or not */
if($forms->delete()==true)
{
if ($forms->delete() == true) {
/* redirect to Index page with Success Message */
return redirect('form')->with('success','Form Deleted Successfully');
}
else
{
return redirect('form')->with('success', 'Form Deleted Successfully');
} else {
/* redirect to Index page with Fails Message */
return redirect('form')->with('fails','Form can not Deleted');
return redirect('form')->with('fails', 'Form can not Deleted');
}
}
catch(Exception $e)
{
} catch (Exception $e) {
/* Redirect to Index page with Fail Message */
return redirect('form')->with('fails','Form can not Create');
return redirect('form')->with('fails', 'Form can not Create');
}
}
}