Unifiedtransform
Unifiedtransform copied to clipboard
Uploading syllabus and notice doesn’t store class number
Hello everyone When I upload syllabus or notice, the class number shows 0 in class field of syllabuses and notices tables in database.
I’m using xampp on Windows 10 in development mode (local machine)
Thanks
This is cached for 24hrs. Please read instructions about it in readme.md file
Yes, but the problem is there is not class_id / course_id passed when storing (syllabus; routine; or notice). I've checked the forms and in components.file.uploader, not parameters called (class_id...)
section_id
is passed with which class_id
is used as foreign key. Here section_id
is table column name, not Section number.
I've just uploaded a syllabus for class 1 and it didn't show in the syllabuses list under that class after checking the database school_id => 1; user_id => 2 and class_id => 0. Same thing with routine and notice. Procedure: From admin dashboard:
- click on "Classes and Sections"
- View syllabuses for this class
- Enter syllabus name in the field (syllabus upload test and choose) the file
- Click on upload
- Message "Upload finished." After refreshing it is not in the list and class_id is 0 in database syllabuses table. One more thing: In store function of SyllabusController there is no class_id In Create function of the controller I put : die ($class_id); I get blanc page and if I put die ('Hello') I get Hello.
I'm trying to find out where is the problem, so in create function I took out the "int" word like this: create($class_id) instead of create (int $class_id) and I get the id of the class (may be because of the php vertion: I'm using the latest) But in store function there is no $class_id passed in the list:
$tb = new Syllabus;
$tb->file_path = $request->file_path;
$tb->title = $request->title;
$tb->active = 1;
$tb->school_id = \Auth::user()->school_id;
$tb->user_id = \Auth::user()->id;
$tb->save();
Same thing in UploadController:
$tb = new \App\Syllabus;
$tb->file_path = 'storage/'.$path;
$tb->title = $request->title;
$tb->active = 1;
$tb->school_id = auth()->user()->school_id;
$tb->user_id = auth()->user()->id;
$tb->save();
And in "file-uploader.blade.php":
@if($upload_type != 'profile')
<h3>{{__(ucfirst($upload_type))}}</h3>
<label for="upload-title">@lang('File Title'): </label>
<input type="text" class="form-control" name="upload-title" id="upload-title"
placeholder="@lang('File title here...')" required>
<br/>
@endif
So the question is where did you put the "class_id" param to be passed for the syllabus instance for storing? I can't find till now.
I forgot to add these in Routine and Syllabus upload forms but I added the fields in Seeder files.
Now I have updated the code base with a commit. Update your code base with latest repository code.
Thanks too much