Permalink
Browse files

ingored welcome.blade.php

  • Loading branch information...
1 parent c8a7bdf commit c11a74a24416e6e61d07145f542c5c98df307345 @gdbhosale gdbhosale committed Jun 26, 2016
View
@@ -0,0 +1 @@
+src/Installs/resources/views/welcome.blade.php
@@ -0,0 +1,185 @@
+<?php
+/**
+ * Controller genrated using LaraAdmin
+ * Help: http://laraadmin.com
+ */
+
+namespace App\Http\Controllers\LA;
+
+use App\Http\Controllers\Controller;
+use Illuminate\Http\Request;
+use App\Http\Requests;
+use Auth;
+use DB;
+use Validator;
+use Datatables;
+use Collective\Html\FormFacade as Form;
+use Dwij\Laraadmin\Models\Module;
+
+use App\Student;
+
+class StudentsController extends Controller
+{
+ public $show_action = true;
+ public $view_col = 'name';
+ public $listing_cols = ['id', 'name', 'roll_number', 'profile_image', 'weight', 'mobile', 'email', 'biography', 'fav_genre', 'resume', 'way_commute'];
+
+ public function __construct() {
+ // for authentication (optional)
+ $this->middleware('auth');
+ }
+
+ /**
+ * Display a listing of the Students.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function index()
+ {
+ $module = Module::get('Students');
+
+ return View('la.students.index', [
+ 'show_actions' => $this->show_action,
+ 'listing_cols' => $this->listing_cols,
+ 'module' => $module
+ ]);
+ }
+
+ /**
+ * Show the form for creating a new student.
+ *
+ * @return \Illuminate\Http\Response
+ */
+ public function create()
+ {
+ //
+ }
+
+ /**
+ * Store a newly created student in database.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @return \Illuminate\Http\Response
+ */
+ public function store(Request $request)
+ {
+ $rules = Module::validateRules("Students", $request);
+
+ $validator = Validator::make($request->all(), $rules);
+
+ if ($validator->fails()) {
+ return redirect()->back()->withErrors($validator)->withInput();
+ }
+
+ $insert_id = Module::insert("Students", $request);
+
+ return redirect()->route(config('laraadmin.adminRoute') . '.students.index');
+ }
+
+ /**
+ * Display the specified student.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function show($id)
+ {
+ $student = Student::find($id);
+ $module = Module::get('Students');
+ $module->row = $student;
+ return view('la.students.show', [
+ 'module' => $module,
+ 'view_col' => $this->view_col,
+ 'no_header' => true,
+ 'no_padding' => "no-padding"
+ ])->with('student', $student);
+ }
+
+ /**
+ * Show the form for editing the specified student.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function edit($id)
+ {
+ $student = Student::find($id);
+
+ $module = Module::get('Students');
+
+ $module->row = $student;
+
+ return view('la.students.edit', [
+ 'module' => $module,
+ 'view_col' => $this->view_col,
+ ])->with('student', $student);
+ }
+
+ /**
+ * Update the specified student in storage.
+ *
+ * @param \Illuminate\Http\Request $request
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function update(Request $request, $id)
+ {
+ $rules = Module::validateRules("Students", $request);
+
+ $validator = Validator::make($request->all(), $rules);
+
+ if ($validator->fails()) {
+ return redirect()->back()->withErrors($validator)->withInput();;
+ }
+
+ $insert_id = Module::updateRow("Students", $request, $id);
+
+ return redirect()->route(config('laraadmin.adminRoute') . '.students.index');
+ }
+
+ /**
+ * Remove the specified student from storage.
+ *
+ * @param int $id
+ * @return \Illuminate\Http\Response
+ */
+ public function destroy($id)
+ {
+ Student::find($id)->delete();
+ // Redirecting to index() method
+ return redirect()->route(config('laraadmin.adminRoute') . '.students.index');
+ }
+
+ /**
+ * Datatable Ajax fetch
+ *
+ * @return
+ */
+ public function dtajax()
+ {
+ $users = DB::table('students')->select($this->listing_cols);
+ $out = Datatables::of($users)->make();
+ $data = $out->getData();
+
+ for($i=0; $i<count($data->data); $i++) {
+ for ($j=0; $j < count($this->listing_cols); $j++) {
+ $col = $this->listing_cols[$j];
+ if($col == $this->view_col) {
+ $data->data[$i][$j] = '<a href="'.url(config('laraadmin.adminRoute') . '/students/'.$data->data[$i][0]).'">'.$data->data[$i][$j].'</a>';
+ }
+ // else if($col == "author") {
+ // $data->data[$i][$j];
+ // }
+ }
+ if($this->show_action) {
+ $output = '<a href="'.url(config('laraadmin.adminRoute') . '/students/'.$data->data[$i][0].'/edit').'" class="btn btn-warning btn-xs" style="display:inline;padding:2px 5px 3px 5px;"><i class="fa fa-edit"></i></a>';
+ $output .= Form::open(['route' => [config('laraadmin.adminRoute') . '.students.destroy', $data->data[$i][0]], 'method' => 'delete', 'style'=>'display:inline']);
+ $output .= ' <button class="btn btn-danger btn-xs" type="submit"><i class="fa fa-times"></i></button>';
+ $output .= Form::close();
+ $data->data[$i][] = (string)$output;
+ }
+ }
+ $out->setData($data);
+ return $out;
+ }
+}
@@ -22,3 +22,8 @@
/* ================== Employees ================== */
Route::resource(config('laraadmin.adminRoute') . '/employees', 'LA\EmployeesController');
Route::get(config('laraadmin.adminRoute') . '/employee_dt_ajax', 'LA\EmployeesController@dtajax');
+
+
+/* ================== Students ================== */
+Route::resource(config('laraadmin.adminRoute') . '/students', 'LA\StudentsController');
+Route::get(config('laraadmin.adminRoute') . '/student_dt_ajax', 'LA\StudentsController@dtajax');
@@ -0,0 +1,72 @@
+<?php
+/**
+ * Migration genrated using LaraAdmin
+ * Help: http://laraadmin.com
+ */
+
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+use Dwij\Laraadmin\Models\Module;
+use Dwij\Laraadmin\Models\ModuleFields;
+use App\Student;
+
+class CreateStudentsTable extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Module::generate("Students", 'students', 'view_column_name e.g. name', [
+ ["name", "Name", "Name", false, "John Doe", 5, 256, true],
+ ]);
+
+ /*
+ Row Format:
+ ["field_name_db", "Label", "UI Type", "Readonly", "Default_Value", "min_length", "max_length", "Required", "Pop_values"]
+ Module::generate("Module_ Name", "Table_Name", "view_column_name" []);
+
+ Module::generate("Books", 'books', 'name', [
+ ["address", "Address", "Address", false, "", 0, 1000, true],
+ ["restricted", "Restricted", "Checkbox", false, false, 0, 0, false],
+ ["price", "Price", "Currency", false, 0.0, 0, 0, true],
+ ["date_release", "Date of Release", "Date", false, "date('Y-m-d')", 0, 0, false],
+ ["time_started", "Start Time", "Datetime", false, "date('Y-m-d H:i:s')", 0, 0, false],
+ ["weight", "Weight", "Decimal", false, 0.0, 0, 20, true],
+ ["publisher", "Publisher", "Dropdown", false, "Marvel", 0, 0, false, ["Bloomsbury","Marvel","Universal"]],
+ ["publisher", "Publisher", "Dropdown", false, 3, 0, 0, false, "@publishers"],
+ ["email", "Email", "Email", false, "", 0, 0, false],
+ ["file", "File", "File", false, "", 0, 256, false],
+ ["weight", "Weight", "Float", false, 0.0, 0, 20.00, true],
+ ["biography", "Biography", "HTML", false, "<p>This is description</p>", 0, 0, true],
+ ["profile_image", "Profile Image", "Image", false, "img_path.jpg", 0, 256, false],
+ ["pages", "Pages", "Integer", false, 0, 0, 5000, false],
+ ["mobile", "Mobile", "Mobile", false, "+91 8888888888", 0, 20, false],
+ ["media_type", "Media Type", "Multiselect", false, ["Audiobook"], 0, 0, false, ["Print","Audiobook","E-book"]],
+ ["media_type", "Media Type", "Multiselect", false, [2,3], 0, 0, false, @media_types],
+ ["name", "Name", "Name", false, "John Doe", 5, 256, true],
+ ["password", "Password", "Password", false, "", 6, 256, true],
+ ["status", "Status", "Radio", false, "Published", 0, 0, false, ["Draft","Published","Unpublished"]],
+ ["author", "Author", "String", false, "JRR Tolkien", 0, 256, true],
+ ["genre", "Genre", "Taginput", false, ["Fantacy","Adventure"], 0, 0, false],
+ ["description", "Description", "Textarea", false, "", 0, 1000, false],
+ ["short_intro", "Short Introduction", "TextField", false, "", 5, 256, true],
+ ["website", "Website", "URL", false, "http://dwij.in", 0, 0, false],
+ ]);
+ */
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+ if (Schema::hasTable('students')) {
+ Schema::drop('students');
+ }
+ }
+}
@@ -39,6 +39,7 @@
<li><a href="#"><i class='fa fa-newspaper-o'></i> <span>Contacts</span> <small class="label pull-right bg-green">2 New</small></a></li>
<li><a href="#"><i class='fa fa-calendar'></i> <span>Calendar</span></a></li>
<li><a href="{{ url(config('laraadmin.adminRoute') . '/books') }}"><i class='fa fa-book'></i> <span>Books</span></a></li>
+ <li><a href="{{ url(config("laraadmin.adminRoute") . '/students') }}"><i class="fa fa-cube"></i> <span>Students</span></a></li>
<!-- LAMenus -->
@@ -0,0 +1,62 @@
+@extends("la.layouts.app")
+
+@section("contentheader_title", "Edit student: ")
+@section("contentheader_description", $student->$view_col)
+@section("section", "Students")
+@section("section_url", url(config('laraadmin.adminRoute') . '/students'))
+@section("sub_section", "Edit")
+
+@section("htmlheader_title", "Student Edit : ".$student->$view_col)
+
+@section("main-content")
+<div class="box">
+ <div class="box-header">
+
+ </div>
+ <div class="box-body">
+ <div class="row">
+ <div class="col-md-8 col-md-offset-2">
+ {!! Form::model($student, ['route' => [config('laraadmin.adminRoute') . '.students.update', $student->id ], 'method'=>'PUT', 'id' => 'student-edit-form']) !!}
+ @la_form($module)
+
+ {{--
+ @la_input($module, 'name')
+ @la_input($module, 'roll_number')
+ @la_input($module, 'profile_image')
+ @la_input($module, 'weight')
+ @la_input($module, 'mobile')
+ @la_input($module, 'email')
+ @la_input($module, 'biography')
+ @la_input($module, 'fav_genre')
+ @la_input($module, 'resume')
+ @la_input($module, 'way_commute')
+ --}}
+ <br>
+ <div class="form-group">
+ {!! Form::submit( 'Update', ['class'=>'btn btn-success']) !!} <button class="btn btn-default pull-right"><a href="{{ url(config('laraadmin.adminRoute') . '/students') }}">Cancel</a></button>
+ </div>
+ {!! Form::close() !!}
+
+ @if($errors->any())
+ <ul class="alert alert-danger">
+ @foreach($errors->all() as $error)
+ <li>{{ $error }}</li>
+ @endforeach
+ </ul>
+ @endif
+ </div>
+ </div>
+ </div>
+</div>
+
+@endsection
+
+@push('scripts')
+<script>
+$(function () {
+ $("#student-edit-form").validate({
+
+ });
+});
+</script>
+@endpush
Oops, something went wrong.

0 comments on commit c11a74a

Please sign in to comment.