title: I get this error when I try to register a new user. 'The department id must be an integer.'
body: <p>I get this error when I try to register a new user: 'The department id must be an integer'. All the answers I'm receiving are helpful just that I get confused at times. So I've added more codes for clarification purposes. I have been battling around for some hours now. Here is the migration file.</p>
  <pre><code>                        Schema::create('departments', function (Blueprint $table) {
                          $table-&gt;bigIncrements('department_id');
                          $table-&gt;integer('department_name');
                          $table-&gt;integer('department_code')-&gt;unique();
                          $table-&gt;text('department_discription')-&gt;nullable();
                          $table-&gt;tinyInteger('department_status')-&gt;default(1);
                          $table-&gt;softDeletes();
                          $table-&gt;timestamps();
          
  </code></pre>
  <p>This is the DepartmentController codes</p>
  <pre><code>        &lt;?php
          
          namespace App\Http\Controllers;
          
          use App\Http\Requests\CreateDepartmentRequest;
          use App\Http\Requests\UpdateDepartmentRequest;
          use App\Repositories\DepartmentRepository;
          use App\Http\Controllers\AppBaseController;
          use Illuminate\Http\Request;
          use Flash;
          use Response;
          
          class DepartmentController extends AppBaseController
          {
              /** @var  DepartmentRepository */
              private $departmentRepository;
          
              public function __construct(DepartmentRepository $departmentRepo)
              {
                  $this-&gt;departmentRepository = $departmentRepo;
              }
          
              /**
               * Display a listing of the Department.
               *
               * @param Request $request
               *
               * @return Response
               */
              public function index(Request $request)
              {
                  $departments = $this-&gt;departmentRepository-&gt;all();
          
                  return view('departments.index')
                      -&gt;with('departments', $departments);
              }
          
              /**
               * Show the form for creating a new Department.
               *
               * @return Response
               */
              public function create()
              {
                  return view('departments.create');
              }
          
              /**
               * Store a newly created Department in storage.
               *
               * @param CreateDepartmentRequest $request
               *
               * @return Response
               */
              public function store(CreateDepartmentRequest $request)
              {
                  $input = $request-&gt;all();
          
                  $department = $this-&gt;departmentRepository-&gt;create($input);
          
                  Flash::success('Department saved successfully.');
          
                  return redirect(route('departments.index'));
              }
          
              /**
               * Display the specified Department.
               *
               * @param int $id
               *
               * @return Response
               */
              public function show($id)
              {
                  $department = $this-&gt;departmentRepository-&gt;find($id);
          
                  if (empty($department)) {
                      Flash::error('Department not found');
          
                      return redirect(route('departments.index'));
                  }
          
                  return view('departments.show')-&gt;with('department', $department);
              }
          
              /**
               * Show the form for editing the specified Department.
               *
               * @param int $id
               *
               * @return Response
               */
              public function edit($id)
              {
                  $department = $this-&gt;departmentRepository-&gt;find($id);
          
                  if (empty($department)) {
                      Flash::error('Department not found');
          
                      return redirect(route('departments.index'));
                  }
          
                  return view('departments.edit')-&gt;with('department', $department);
              }
          
              /**
               * Update the specified Department in storage.
               *
               * @param int $id
               * @param UpdateDepartmentRequest $request
               *
               * @return Response
               */
              public function update($id, UpdateDepartmentRequest $request)
              {
                  $department = $this-&gt;departmentRepository-&gt;find($id);
          
                  if (empty($department)) {
                      Flash::error('Department not found');
          
                      return redirect(route('departments.index'));
                  }
          
                  $department = $this-&gt;departmentRepository-&gt;update($request-&gt;all(), $id);
          
                  Flash::success('Department updated successfully.');
          
                  return redirect(route('departments.index'));
              }
          
              /**
               * Remove the specified Department from storage.
               *
               * @param int $id
               *
               * @throws \Exception
               *
               * @return Response
               */
              public function destroy($id)
              {
                  $department = $this-&gt;departmentRepository-&gt;find($id);
          
                  if (empty($department)) {
                      Flash::error('Department not found');
          
                      return redirect(route('departments.index'));
                  }
          
                  $this-&gt;departmentRepository-&gt;delete($id);
          
                  Flash::success('Department deleted successfully.');
          
                  return redirect(route('departments.index'));
              }
          }
  </code></pre>
  <p>here is the department code</p>
  <pre><code>&lt;?php
  
  namespace App\Models;
  
  use Eloquent as Model;
  use Illuminate\Database\Eloquent\SoftDeletes;
  
  /**
   * Class Departments
   * @package App\Models
   * @version September 21, 2020, 4:31 pm UTC
   *
   * @property integer $department_name
   * @property integer $department_code
   * @property string $department_discription
   * @property boolean $department_status
   */
  class Departments extends Model
  {
      use SoftDeletes;
  
      public $table = 'departments';
      
      const CREATED_AT = 'created_at';
      const UPDATED_AT = 'updated_at';
  
  
      protected $dates = ['deleted_at'];
  
  
  
      public $fillable = [
          'department_name',
          'department_code',
          'department_discription',
          'department_status'
      ];
  
      
      /**
       * The attributes that should be casted to native types.
       *
       * @var array
       */
      protected $casts = [
          'department_id' =&gt; 'integer',
          'department_name' =&gt; 'integer',
          'department_code' =&gt; 'integer',
          'department_discription' =&gt; 'string',
          'department_status' =&gt; 'boolean'
      ];
  
      /**
       * Validation rules
       *
       * @var array
       */
      public static $rules = [
          'department_name' =&gt; 'required|integer',
          'department_code' =&gt; 'required|integer',
          'department_discription' =&gt; 'nullable|string',
          'department_status' =&gt; 'required|boolean',
          'deleted_at' =&gt; 'nullable',
          'created_at' =&gt; 'nullable',
          'updated_at' =&gt; 'nullable'
      ];
  }
  </code></pre>