<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vicky Alvando</title>
    <description>The latest articles on DEV Community by Vicky Alvando (@vickyalvandob).</description>
    <link>https://dev.to/vickyalvandob</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F995040%2Fafa9a5b4-2ac0-495f-8995-54f2b0d47d17.png</url>
      <title>DEV Community: Vicky Alvando</title>
      <link>https://dev.to/vickyalvandob</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vickyalvandob"/>
    <language>en</language>
    <item>
      <title>Creating a Social Media Website with Laravel 9</title>
      <dc:creator>Vicky Alvando</dc:creator>
      <pubDate>Sat, 06 May 2023 06:57:28 +0000</pubDate>
      <link>https://dev.to/vickyalvandob/creating-a-social-media-website-with-laravel-9-38of</link>
      <guid>https://dev.to/vickyalvandob/creating-a-social-media-website-with-laravel-9-38of</guid>
      <description>&lt;p&gt;Creating a Social Media Website with Laravel 9&lt;/p&gt;

&lt;p&gt;Introduction&lt;br&gt;
Discover the power of Laravel 9 in building your own social media platform. &lt;/p&gt;

&lt;p&gt;With Laravel 9, you can create a secure, scalable, and engaging website. Let's dive in and unlock the potential of social media development.&lt;/p&gt;

&lt;p&gt;Why Choose Laravel 9?&lt;/p&gt;

&lt;p&gt;Superior Performance: Laravel 9 delivers exceptional performance, ensuring a smooth user experience even under heavy loads.&lt;/p&gt;

&lt;p&gt;Enhanced Security: Protect user data with robust security features against attacks like XSS and CSRF.&lt;/p&gt;

&lt;p&gt;Rapid Development: Build your social media website quickly and efficiently with Laravel 9's intuitive syntax and powerful tools.&lt;/p&gt;

&lt;p&gt;Steps to Build Your Social Media Website:&lt;/p&gt;

&lt;p&gt;Initial Configuration: Install Laravel 9 and set up your development environment.&lt;/p&gt;

&lt;p&gt;Database Design: Plan your database structure and use Laravel 9's migration feature to create tables.&lt;/p&gt;

&lt;p&gt;Authentication and Authorization: Implement a secure authentication system and control user access.&lt;/p&gt;

&lt;p&gt;Post Creation and Interactions: Enable users to create, edit, and interact with posts, including likes and comments.&lt;/p&gt;

&lt;p&gt;UI Development: Design a visually appealing and user-friendly interface.&lt;/p&gt;

&lt;p&gt;Testing and Deployment: Ensure functionality, performance, and security before deploying your website.&lt;/p&gt;

&lt;p&gt;Unleash the Power of Laravel 9 for Your Social Media Success!&lt;/p&gt;

&lt;p&gt;Watch more on youtube : &lt;a href="https://youtu.be/NjqVhu2QO_I"&gt;https://youtu.be/NjqVhu2QO_I&lt;/a&gt;&lt;/p&gt;

</description>
      <category>socialmedia</category>
      <category>programming</category>
      <category>laravel</category>
    </item>
    <item>
      <title>Online Test - Create Model And Migration #2</title>
      <dc:creator>Vicky Alvando</dc:creator>
      <pubDate>Fri, 23 Dec 2022 06:45:07 +0000</pubDate>
      <link>https://dev.to/vickyalvandob/online-test-create-model-and-migration-166j</link>
      <guid>https://dev.to/vickyalvandob/online-test-create-model-and-migration-166j</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1 - Create Model &amp;amp; Migration Lesson&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Lesson -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('lessons', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;string('title')-&amp;gt;unique();
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Lesson.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Lesson extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'title',
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 - Create Model &amp;amp; Migration Classroom&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Classroom -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('classrooms', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;string('title')-&amp;gt;unique();
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Classroom.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Classroom extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'title',
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3 - Create Model &amp;amp; Migration Exam&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Exam -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('exams', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;string('title');
        $table-&amp;gt;foreignId('lesson_id')-&amp;gt;references('id')-&amp;gt;on('lessons')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('classroom_id')-&amp;gt;references('id')-&amp;gt;on('classrooms')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;integer('duration');
        $table-&amp;gt;text('description');
        $table-&amp;gt;enum('random_question', ['Y', 'N'])-&amp;gt;default('Y');
        $table-&amp;gt;enum('random_answer', ['Y', 'N'])-&amp;gt;default('Y');
        $table-&amp;gt;enum('show_answer', ['Y', 'N'])-&amp;gt;default('N');
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Exam.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Exam extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'title',
        'lesson_id',
        'classroom_id',
        'duration',
        'description',
        'random_question',
        'random_answer',
        'show_answer',
    ];

    /**
     * lesson
     *
     * @return void
     */
    public function lesson()
    {
        return $this-&amp;gt;belongsTo(Lesson::class);
    }

    /**
     * classroom
     *
     * @return void
     */
    public function classroom()
    {
        return $this-&amp;gt;belongsTo(Classroom::class);
    }

    /**
     * questions
     *
     * @return void
     */
    public function questions()
    {
        return $this-&amp;gt;hasMany(Question::class)-&amp;gt;orderBy('id', 'DESC');
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4 - Create Model &amp;amp; Migration Student&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Student -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('students', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('classroom_id')-&amp;gt;references('id')-&amp;gt;on('classrooms')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;bigInteger('nisn')-&amp;gt;unique();
        $table-&amp;gt;string('name');
        $table-&amp;gt;string('password');
        $table-&amp;gt;enum('gender', ['L', 'P'])-&amp;gt;default('L');
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Student.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'classroom_id',
        'nisn',
        'name',
        'password',
        'gender'
    ];  

    /**
     * classroom
     *
     * @return void
     */
    public function classroom()
    {
        return $this-&amp;gt;belongsTo(Classroom::class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5 - Create Model &amp;amp; Migration Question&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Question -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('questions', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('exam_id')-&amp;gt;references('id')-&amp;gt;on('exams')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;text('question');
        $table-&amp;gt;text('option_1')-&amp;gt;nullable();
        $table-&amp;gt;text('option_2')-&amp;gt;nullable();
        $table-&amp;gt;text('option_3')-&amp;gt;nullable();
        $table-&amp;gt;text('option_4')-&amp;gt;nullable();
        $table-&amp;gt;text('option_5')-&amp;gt;nullable();
        $table-&amp;gt;integer('answer');  
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Question.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Question extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'exam_id',
        'question',
        'option_1',
        'option_2',
        'option_3',
        'option_4',
        'option_5',
        'answer',
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6 - Create Model &amp;amp; Migration Exam Session&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model ExamSession -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('exam_sessions', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('exam_id')-&amp;gt;references('id')-&amp;gt;on('exams')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;string('title');
        $table-&amp;gt;dateTime('start_time');
        $table-&amp;gt;dateTime('end_time');
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/ExamSession.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ExamSession extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'exam_id',
        'title',
        'start_time',
        'end_time',
    ];

    /**
     * exam_groups
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function exam_groups()
    {
        return $this-&amp;gt;hasMany(ExamGroup::class);
    }

    /**
     * exam
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function exam()
    {
        return $this-&amp;gt;belongsTo(Exam::class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7 - Create Model &amp;amp; Migration Exam Group&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model ExamGroup -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('exam_groups', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('exam_id')-&amp;gt;references('id')-&amp;gt;on('exams')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('exam_session_id')-&amp;gt;references('id')-&amp;gt;on('exam_sessions')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('student_id')-&amp;gt;references('id')-&amp;gt;on('students')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/ExamGroup.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ExamGroup extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'exam_id',
        'exam_session_id',
        'student_id',
    ];

    /**
     * exam
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function exam()
    {
        return $this-&amp;gt;belongsTo(Exam::class);
    }

    /**
     * exam_session
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function exam_session()
    {
        return $this-&amp;gt;belongsTo(ExamSession::class);
    }

    /**
     * student
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function student()
    {
        return $this-&amp;gt;belongsTo(Student::class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8 - Create Model &amp;amp; Migration Answer&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Answer -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('answers', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('exam_id')-&amp;gt;references('id')-&amp;gt;on('exams')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('exam_session_id')-&amp;gt;references('id')-&amp;gt;on('exam_sessions')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('question_id')-&amp;gt;references('id')-&amp;gt;on('questions')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('student_id')-&amp;gt;references('id')-&amp;gt;on('students')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;integer('question_order');
        $table-&amp;gt;string('answer_order');
        $table-&amp;gt;integer('answer');
        $table-&amp;gt;enum('is_correct', ['Y', 'N'])-&amp;gt;default('N');
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Answer.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Answer extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'exam_id',
        'exam_session_id',
        'question_id',
        'student_id',
        'question_order',
        'answer_order',
        'answer',
        'is_correct',
    ];

    /**
     * question
     *
     * @return void
     */
    public function question()
    {
        return $this-&amp;gt;belongsTo(Question::class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 9 - Create Model &amp;amp; Migration Grade&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan make:model Grade -m
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the migration file, then in the section &lt;strong&gt;function up&lt;/strong&gt; change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function up()
{
    Schema::create('grades', function (Blueprint $table) {
        $table-&amp;gt;id();
        $table-&amp;gt;foreignId('exam_id')-&amp;gt;references('id')-&amp;gt;on('exams')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('exam_session_id')-&amp;gt;references('id')-&amp;gt;on('exam_sessions')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;foreignId('student_id')-&amp;gt;references('id')-&amp;gt;on('students')-&amp;gt;cascadeOnDelete();
        $table-&amp;gt;integer('duration');
        $table-&amp;gt;dateTime('start_time')-&amp;gt;nullable();
        $table-&amp;gt;dateTime('end_time')-&amp;gt;nullable();
        $table-&amp;gt;integer('total_correct');
        $table-&amp;gt;decimal('grade', 5, 2);
        $table-&amp;gt;timestamps();
    });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please open the file &lt;strong&gt;app/Models/Grade.php&lt;/strong&gt;, then change the code to be like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Grade extends Model
{
    use HasFactory;

    /**
     * fillable
     *
     * @var array
     */
    protected $fillable = [
        'exam_id',
        'exam_session_id',
        'student_id',
        'duration',
        'start_time',
        'end_time',
        'total_correct',
        'grade',
    ];

    /**
     * exam
     *
     * @return void
     */
    public function exam()
    {
        return $this-&amp;gt;belongsTo(Exam::class);
    }

    /**
     * exam_session
     *
     * @return void
     */
    public function exam_session()
    {
        return $this-&amp;gt;belongsTo(ExamSession::class);
    }

    /**
     * student
     *
     * @return void
     */
    public function student()
    {
        return $this-&amp;gt;belongsTo(Student::class);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 10 - Running the migration&lt;/strong&gt;&lt;br&gt;
After successfully creating the &lt;strong&gt;Model and Migration&lt;/strong&gt;, now we will run the migrate command so tah the code tah we created above can be generated into tables, filds and relations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php artisan migrate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Online Test - Set Up Project #1</title>
      <dc:creator>Vicky Alvando</dc:creator>
      <pubDate>Fri, 23 Dec 2022 06:14:30 +0000</pubDate>
      <link>https://dev.to/vickyalvandob/creating-a-laravel-project-with-composer-mi3</link>
      <guid>https://dev.to/vickyalvandob/creating-a-laravel-project-with-composer-mi3</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1 - Create Laravel Poject&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;composer create-project --prefer-dist laravel/laravel:9.3.1 online-test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 - Timezone Configuration&lt;/strong&gt;&lt;br&gt;
Please open the file &lt;strong&gt;config/app.hp&lt;/strong&gt;, then look for the folowing code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'timezone' =&amp;gt; 'UTC',


'locale' =&amp;gt; 'en',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And change it to be like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'timezone' =&amp;gt; 'Asia/Jakarta',

'locale' =&amp;gt; 'id',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3 - Database Configuration&lt;/strong&gt;&lt;br&gt;
To connect the laravel project to the database, we just need to make a few changes in the &lt;strong&gt;.env&lt;/strong&gt;. Please open the file, the look for the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, change it to be like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_DATABASE=online_test
DB_USERNAME=root
DB_PASSWORD=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After successsfully configuring the database connection, the next step is to create the database with the name &lt;strong&gt;online_test&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>changelog</category>
      <category>forem</category>
    </item>
  </channel>
</rss>
