public function run()
 {
     for ($i = 0; $i < 100; $i++) {
         $s = new \App\Student();
         $s->full_name = "Student {$i}";
         $s->number_phone = "099999000{$i}";
         $s->email = "email{$i}@gmail.com";
         $s->sex = rand(0, 1);
         $s->birthday = rand(111111, 999999);
         $s->address = "Address{$i}";
         $s->university = "University{$i}";
         $s->branch = rand(1, 7);
         $s->year = rand(111111, 999999);
         $s->source_id = rand();
         $s->user_id = rand(1, 9);
         $s->save();
     }
 }
Esempio n. 2
0
<?php

Route::bind('user', function ($id) {
    return App\User::whereId($id)->first();
});
Route::bind('student', function ($id) {
    return App\Student::whereStudentId($id)->first();
});
Route::bind('role', function ($id) {
    return App\Role::whereId($id)->first();
});
Route::bind('information', function ($id) {
    return App\Information::whereId($id)->first();
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', ['as' => 'home', 'uses' => 'HomeController@index']);
Route::get('home', ['as' => 'home', 'uses' => 'HomeController@index']);
// AUTH CONTROLLERS
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
// USER
Route::resource('user', 'UserController');
post('update/{user_id}/role', ['as' => 'update_role', 'uses' => 'UserController@updateRoles']);
Esempio n. 3
0
<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    $student = App\Student::with('subjects')->find(1);
    dd("pivot model>>>", $student->subjects()->first()->pivot, "property that we expect will be casted>>>", $student->subjects()->first()->pivot->marks, "^^^^^ [oops) string...] ^^^^^");
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function () {
    //
});
Esempio n. 4
0
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
    return view('welcome');
});
Route::get('/students/seed', function () {
    $faker = Faker\Factory::create();
    DB::table('students')->truncate();
    for ($i = 1; $i < 25; $i++) {
        $student = new \App\Student();
        $student->name = $faker->name;
        $student->address = $faker->address;
        $student->save();
    }
});
Route::get('/students', function () {
    return \App\Student::all();
});
Route::post('/device', function () {
    $all = Request::json()->all();
    var_dump($all);
});
/*
|--------------------------------------------------------------------------
| Application Routes
Esempio n. 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $school = new \App\School();
     $school->name = "Royal College";
     $school->city = "Colombo 07";
     $school->district = "Colombo";
     $school->in_quota = 200;
     $school->comes_in = true;
     $school->goes_out = false;
     $school->cutoff_mark = 175;
     $school->save();
     $school = new \App\School();
     $school->name = "Ananda College";
     $school->city = "Colombo 10";
     $school->district = "Colombo";
     $school->in_quota = 150;
     $school->comes_in = true;
     $school->goes_out = false;
     $school->cutoff_mark = 170;
     $school->save();
     $school = new \App\School();
     $school->name = "Maliyadeva College";
     $school->city = "Kurunegala";
     $school->district = "Kurunegala";
     $school->in_quota = 100;
     $school->comes_in = true;
     $school->goes_out = true;
     $school->cutoff_mark = 168;
     $school->save();
     $school = new \App\School();
     $school->name = "Dharmaraja College";
     $school->city = "Kandy";
     $school->district = "Kandy";
     $school->in_quota = 150;
     $school->comes_in = true;
     $school->goes_out = false;
     $school->cutoff_mark = 172;
     $school->save();
     $school = new \App\School();
     $school->name = "Nalanda College";
     $school->city = "Colombo 10";
     $school->district = "Colombo";
     $school->in_quota = 100;
     $school->comes_in = true;
     $school->goes_out = false;
     $school->cutoff_mark = 168;
     $school->save();
     $school = new \App\School();
     $school->name = "Mahanama College";
     $school->city = "Colombo 03";
     $school->district = "Colombo";
     $school->in_quota = 50;
     $school->comes_in = true;
     $school->goes_out = true;
     $school->cutoff_mark = 160;
     $school->save();
     $school = new \App\School();
     $school->name = "Bandaranayake College";
     $school->city = "Gampaha";
     $school->district = "Gampaha";
     $school->in_quota = 50;
     $school->comes_in = true;
     $school->goes_out = true;
     $school->cutoff_mark = 160;
     $school->save();
     $school = new \App\School();
     $school->name = "Horagasmulla Primary School";
     $school->city = "Divulapitiya";
     $school->district = "Gampaha";
     $school->in_quota = 0;
     $school->comes_in = false;
     $school->goes_out = true;
     $school->cutoff_mark = 0;
     $school->save();
     $school = new \App\School();
     $school->name = "Balagalla Primary School";
     $school->city = "Divulapitiya";
     $school->district = "Gampaha";
     $school->in_quota = 0;
     $school->comes_in = false;
     $school->goes_out = true;
     $school->cutoff_mark = 0;
     $school->save();
     $school = new \App\School();
     $school->name = "Hunumulla Central College";
     $school->city = "Hunumulla";
     $school->district = "Gampaha";
     $school->in_quota = 20;
     $school->comes_in = true;
     $school->goes_out = true;
     $school->cutoff_mark = 136;
     $school->save();
     $names = array('Nipun Perera', 'Imesha Sudasingha', 'Madhawa Vidanapathirana', 'Jayan Chathuranga', 'Pasindu Kanchana', 'Dulaj Atapattu');
     for ($i = 0; $i < 20; $i++) {
         $student = new \App\Student();
         $student->name = $names[rand(0, count($names) - 1)];
         $student->examination_no = rand(1000000, 9999999);
         $student->results = rand(100, 200);
         $student->password = \Illuminate\Support\Facades\Hash::make("1234");
         $student->school_id = rand(1, 10);
         $student->save();
         $studentexam = new \App\ExamResultsRest();
         $studentexam->name = $student->name;
         $studentexam->examination_number = $student->examination_no;
         $studentexam->dob = "1993-05-01";
         $studentexam->district = "Colombo";
         $studentexam->marks = rand(50, 200);
         $studentexam->school = School::find($student->school_id)->name;
         $studentexam->save();
     }
     Model::reguard();
 }
Esempio n. 6
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']);
Route::bind('classrooms', function ($value, $route) {
    return App\Classroom::find($value);
});
Route::bind('students', function ($value, $route) {
    return App\Student::find($value);
});
Route::get('classrooms/{classroom_id}/students/create', 'StudentsController@create');
Route::post('students', 'StudentsController@store');
Route::resource('classrooms', 'ClassroomController');
Route::resource('classrooms.students', 'StudentsController');
Route::model('classroom', 'Classroom');
Route::model('student', 'Student');
Esempio n. 7
0
 Route::post('password/email', 'Auth\\PasswordController@postEmail');
 // Password reset routes...
 Route::get('password/reset/{token}', 'Auth\\PasswordController@getReset');
 Route::post('password/reset', 'Auth\\PasswordController@postReset');
 // Store Web Inquiries
 Route::post('inquiries/web', ['as' => 'inquiry.storeweb', 'uses' => 'InquiryController@storeWeb']);
 /*
     |------------------------------------
     | Login Required Routes 
     |------------------------------------
 */
 Route::group(['middleware' => 'auth'], function () {
     Route::get('/', function () {
         //return "Hello World";
         $employee_count = App\Employee::all()->count('id');
         $student_count = App\Student::all()->count('id');
         $buyer_count = App\Buyer::all()->count('id');
         $seller_count = App\Seller::all()->count('id');
         $charter_guest_count = App\CharterGuest::all()->count('id');
         return view('index', ['title' => 'Dashboard', 'employee_count' => $employee_count, 'student_count' => $student_count, 'buyer_count' => $buyer_count, 'seller_count' => $seller_count, 'charter_guest_count' => $charter_guest_count]);
     });
     //Inquiry Routes
     Route::get('/inquiries', ['as' => 'inquiries', 'uses' => 'InquiryController@index']);
     Route::get('/inquiries/create', ['as' => 'inquiry.create', 'uses' => 'InquiryController@create']);
     Route::post('inquiries/create', ['as' => 'inquiry.store', 'uses' => 'InquiryController@store']);
     Route::get('/inquiries/{$id}', ['as' => 'inquiry.show', 'uses' => 'InquiryController@show']);
     //Admin Routes
     Route::get('test_schedules/{template}', 'ResponseScheduleController@create');
     Route::get('admin/response_schedules', ['as' => 'admin.respsone_schedules', 'uses' => 'ResponseScheduleController@index']);
     Route::get('admin/response_schedules/{schedule}/send', ['as' => 'admin.respsone_schedules.send', 'uses' => 'ResponseScheduleController@send']);
     Route::get('admin/response_schedules/{schedule}/delete', ['as' => 'admin.response_schedules.delete', 'uses' => 'ResponseScheduleController@delete']);