Skip to content

General error: 1364 Field 'courses_type' doesn't have a default value (SQL: insert into scorm.... #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kreshnik opened this issue Nov 23, 2022 · 4 comments

Comments

@Kreshnik
Copy link

Hi,

I am having trouble getting the laravel-scorm package version 4 to work. An exception is thrown when using the sample code to upload a scorm archive.

Code used:

    public function store(ScormRequest $request)
    {
        try {
            $scorm = $this->scormManager->uploadScormArchive($request->file('file'));
            // handle scorm runtime error msg
        } catch (InvalidScormArchiveException | StorageNotFoundException $ex) {
            return $this->respondCouldNotCreateResource(trans('scorm.' .  $ex->getMessage()));
        }

        // response helper function from base controller reponse json.
        return $this->respond(ScormModel::with('scos')->whereUuid($scorm['uuid'])->first());
    }

The error I am receiving:

"SQLSTATE[HY000]: General error: 1364 Field 'courses_type' doesn't have a default value (SQL: insert into `scorm` (`uuid`, `title`, `version`, `entry_url`, `identifier`, `origin_file`, `updated_at`, `created_at`) values (af86ad2b-4608-4e79-aed2-f15fe32c81b2, Providing Exceptional Customer Service, scorm_12, scormdriver/indexAPI.html, rY3oYmJ0tP1sRwP9mqSHdXYWZXav93-g9N-8RhEs, use-this-scorm.zip, 2022-11-23 12:46:20, 2022-11-23 12:46:20))"

I assume the library is working, but documentation is missing on how to link the relation.

@RayCode98
Copy link

Hi, i have the same problem, you have a solution?

@emanomary
Copy link

I have the same problem

@oliuradu
Copy link

same

@OliveLeb
Copy link

As a workaround, in the migration file generated you can change
$table->morphs($tableNames['resource_table']); to $table->nullableMorphs($tableNames['resource_table']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants