Код: Выделить всё
public function destroy()
{
// Store all contents and delete the first one since this is created via seeder
$contents = $this->contents->all()->toArray();
array_shift($contents);
// Delete db file, creates it from an example file and changes permissions
system('rm -rf ../database/database.sqlite');
system('cp ../database/database.sqlite.example ../database/database.sqlite');
system('chmod 0777 ../database/');
system('chmod 0777 ../database/database.sqlite');
// Insert data
foreach ($contents as $content) {
$this->contents->create($content);
}
return response()->json(['message' => 'Data has been destroyed!']);
}
Код: Выделить всё
SQLSTATE[HY000]General Error: 8 attempt to write a readonly database
Подробнее здесь: https://stackoverflow.com/questions/478 ... readonly-d