Unifiedtransform icon indicating copy to clipboard operation
Unifiedtransform copied to clipboard

Uploading syllabus and notice doesn’t store class number

Open Majidkadi opened this issue 4 years ago • 7 comments

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

Majidkadi avatar Mar 03 '20 15:03 Majidkadi

This is cached for 24hrs. Please read instructions about it in readme.md file

changeweb avatar Mar 05 '20 13:03 changeweb

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...)

Majidkadi avatar Mar 06 '20 17:03 Majidkadi

section_id is passed with which class_id is used as foreign key. Here section_id is table column name, not Section number.

changeweb avatar Mar 06 '20 18:03 changeweb

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:

  1. click on "Classes and Sections"
  2. View syllabuses for this class
  3. Enter syllabus name in the field (syllabus upload test and choose) the file
  4. Click on upload
  5. 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.

Majidkadi avatar Mar 06 '20 22:03 Majidkadi

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.

Majidkadi avatar Mar 07 '20 00:03 Majidkadi

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.

changeweb avatar Mar 07 '20 07:03 changeweb

Thanks too much

Majidkadi avatar Mar 07 '20 11:03 Majidkadi