Student Learning Management System in laravel

Amit Kumar
4 min readMay 21, 2021

--

Download project and configure with Database and migrate’

2nd step-> create model and create controller as given below

php artisan:migrate

php artisan make:auth

Let’ go to create Admin Controller-> run below command

php artisan make:controller Admin

I want field like this

php artisan make:model Oex_category -m

Let’s go to model and paste below code

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOexCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oex_categories', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->nullable();
$table->integer('status')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oex_categories');
}
}

Now set up model filed

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Oex_category extends Model
{
protected $table="oex_categories";
protected $primaryKey="id";
protected $fillable=['name','status'];
}

php artisan migrate

Now table has been migrated successfully.

Next go to create next table

php artisan make:model Oex_exam_master -m

Go to Oex_master migration file and paste below code

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOexExamMastersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oex_exam_masters', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title')->nullable();
$table->string('category')->nullable();
$table->string('exam_date')->nullable();
$table->string('status')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oex_exam_masters');
}
}

Next to Oex_master model file and paste below code

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Oex_exam_master extends Model
{
protected $table="oex_exam_masters";
protected $primaryKey="id";
protected $fillable=[
'title',
'category',
'exam_date',
'status'
];
}

Now migrate the table run this command

php artisan migrate

Now table table has been successfully migrated to database

Now create stuedents table

php artisan make:model Oex_students -m

Next go to student migration file and paste below code

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOexStudentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oex_students', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->nullable();
$table->string('email')->nullable();
$table->string('mobile_no')->nullable();
$table->string('category')->nullable();
$table->string('exam')->nullable();
$table->string('password')->nullable();
$table->string('status')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oex_students');
}
}

Go to model and paste below code

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Oex_students extends Model
{
protected $table="oex_students";
protected $primaryKey="id";
protected $fillable=[
'name',
'email',
'mobile_no',
'category',
'exam',
'password',
'status'
];

}

Run this command

php artisan migrate

table has been migrated successfully

php artisan make:model Oex_portal -m

Go to Oex_portal

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOexPortalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oex_portals', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name')->nullable();
$table->string('email')->nullable();
$table->string('mobile_no')->nullable();
$table->string('password')->nullable();
$table->string('status')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oex_portals');
}
}

Now go to model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Oex_portal extends Model
{
protected $table="oex_portals";
protected $primaryKey="id";
protected $fillable=[
'name',
'email',
'mobile_no',
'password',
'status'
];
}

php artisan migrate

Table migrated successfully

--

--

Amit Kumar
Amit Kumar

Written by Amit Kumar

Hi I am Amit Experienced Web Developer with a demonstrated history of working in the information technology and services industry.

No responses yet