for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/* Require */
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
/* Models */
use Bantenprov\Prestasi\Models\Bantenprov\Prestasi\MasterPrestasi;
class BantenprovPrestasiSeederMasterPrestasi extends Seeder
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
Model::unguard();
$master_prestasis = (object) [
(object) [
'user_id' => '1',
'jenis_prestasi_id' => '1',
'juara' => '1',
'tingkat' => '1',
'nilai' => '10',
'bobot' => '1'
],
'jenis_prestasi_id' => '2',
'juara' => '2',
'tingkat' => '2',
'nilai' => '20',
'bobot' => '2'
]
];
foreach ($master_prestasis as $master_prestasi) {
$model = MasterPrestasi::updateOrCreate(
[
'user_id' => $master_prestasi->user_id,
'jenis_prestasi_id' => $master_prestasi->jenis_prestasi_id,
'juara' => $master_prestasi->juara,
'tingkat' => $master_prestasi->tingkat,
'nilai' => $master_prestasi->nilai,
'bobot' => $master_prestasi->bobot,
);
$model->save();
}
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.