AbdulBazith

AbdulBazith

Member Since 2 Years Ago

India, Tamil Nadu, Tirunelveli

Experience Points
22,440
Total
Experience

2,560 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
9
Lessons
Completed
Best Reply Awards
2
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 5
22,440 XP
Nov
06
3 weeks ago
Activity icon

Started a new Conversation The GET Method Is Not Supported For This Route. Supported Methods: POST Laravel

Guys i have doubt, i need to create a user defined function in POST method.

let me explain what i did

my route

Route::resource('MyTeam', 'MyTeamController');

Route::post('ManageTeam', '[email protected]')->name('ManageTeam');

my form

<form name="team_check" id="team_check" method="post" action="{{ route('ManageTeam') }}">

if i use like above i get the error message

The GET method is not supported for this route. Supported methods: POST.

but if i use get in both side it works fine. but if i use POST in both side, i get the above error message but, this sometimes the error message is not there, works fine. sometimes iam getting this error message.

  1. if i use more than one form tag with different function in a form this error comes??

2)basically a resource controller has index,create, store, show,edit,update, destroy.

without resource controller i need to create a controller with these functions means what should i do

i can give like this php artisan make:controller MYNEWcontroller so i have created a controller now how to declare this in route.php

i expect like this in this new controller with post method.

userdefinedcreate(),
userdefinedindex(),
userdefinedstore(Request $request),
userdefinedshow($id),
userdefinededit($id),
userdefineupdate(Request $request, $id),
userdefineddestroy($id),

Kindly some one help please

Activity icon

Started a new Conversation Ajax Call To Check Whether Username Exist Or Not In Array Format, And To Validate Unique Array Of Text Box For The Same Username Laravel

guys iam working with a project online examination project.

there are totally 250 to 300 staff members. for class 1 20 staff class 2 50 staff like this.

the admin has the permission to change the username and password for staff members.

Here whats my doubt is admin will change the username and password for single staff or bulky for whole class.

for single i have a ajax call, after typing the username it goes to usertable and checks the name exist, and shows a message relevant to that. and at backend i wrote

 $this->validate($request, array(
                'username' => 'required|unique:users,username,'.$user_id,
                'password' => 'required',
            ));

The back end also works fine everything is ok.

Now whats the problem is admin need to change the password bulk, means, class: V has 50 staff members so only for this 50 members the admin need to change the password. so as usual from drop down admin will choose the class, so those class staff members will be listed with their name and username in readonly.

Now there is an extra two textboxes for newusername and newpassword like below

<td>
    <input class="form-control" type="hidden" id="user_id" name="user_id[]" value="{{$member->id}}">

    <input class="form-control" type="text" id="username" name="username[]" value="{{$member->username}}">

</td>

<td> <input class="form-control" type="text" id="password" name="password[]"></td>

now 50 staff members are listed with their username. admin can change the username for all the staff members in the form. but if admin types existing username then it should notify near the textbox. for this i need to write ajax call is there any idea??

same doubt at backend also for unique validation i wrote


 $this->validate($request, array(
                'username.*' => 'required|unique:users,username,'.$user_id,
                'password' => 'required',
            ));

i have added extra * in the username. but this not working

For single everything worked fine. but for bulk iam unable to move.

i have 3 doubts

1)is this a good way to change username and password bulk for users.?if this is not the good way then my client will ask the bulk change of password. because those users itself dont have that permission. only admin should do that. 2)how can i write the ajax call for this bulk check. else there is some other solution? 3)how can i write the unique for this array of textbox?

Kindly some one help please

Oct
31
4 weeks ago
Activity icon

Replied to Fetch Records From Parent With Where Condition In Child Table. Problem In Using "WITH" And "WHEREHAS" Laravel

@silencebringer thank you for your response.

i tried the way u gave the code it fetched empty results

but i shifted it then it worked correctly may i know what may be the problem


$examslist = ExamRequest:: DoesntHave('ExamcreatedModel')->

orwhereHas('ExamcreatedModel', function ($query) {

    $query->where('examstatus', 0);

})
   
    ->get();

this gave the correct output . may i know the difference between "wheredoesnthave" and "doesnthave" ??

Activity icon

Started a new Conversation Fetch Records From Parent With Where Condition In Child Table. Problem In Using "WITH" And "WHEREHAS" Laravel

guys iam working with a student online examination project.

i have two tables ExamRequest and ExamCreation

staff will request for a exam to be create, and exam creation team will create an exam for that request

so here ExamRequest is parent table and ExamCreation is child table with one to one relationship

ExamRequest table with columns

id	examdate	noofques	createdstatus
1	31-10-2020	50			1
2	31-10-2020	50			1
3	31-10-2020	50			0
4	31-10-2020	50			0

in the above table total 4 request are there but only for request exam is created for another 2 request exams not created so,

my ExamCreation table with columns

id	request_id	examdate	examstatus
1	1			31-10-2020	1
2	2			31-10-2020	0

so in the above Examcreation table only two exams are created for the request and in this two exams 1 exam is completed thats why it shows examstatus and "1". and 1 exam not completed.

Let me ask my query, i need to fetch all records from ExamRequest Table with where condition as exams not created and exams created with not completed exams. so i wrote the query as

$examslist = ExamRequest::

whereHas('ExamcreatedModel', function ($query) {

    $query->where('examstatus', 0); })->get();

But the above code brings only one record because it checks for child table with examstatus 0 and brings that record only, but i need the two ExamRequests which are not created also. so iam expecting three records

two records which are not created and 2 record created but exam not completed, so i tried like this using "with"

$examslist = ExamRequest::

with(['ExamcreatedModel'=> function ($query) {

    $query->where('examstatus', 0); }])->get();

But here whats the problem is, here it gives all the records from ExamRequest Table, displays the the request for which exam completed also, that is the where condition is working only for the child table, and not for the requesttable

what i need is to fetch all records from ExamRequest Table with where condition as exams not created and exams created with not completed examsstatus.

Kindly someone suggest your idea please

Oct
27
1 month ago
Activity icon

Replied to Link Or Integrate Zoom Like Video Conferencing Application In My Laravel Project

@van1310 thank you for your response,

actually what my expectation is to develop it from my end itself. no need of depending for other third party for premium,

Oct
26
1 month ago
Activity icon

Started a new Conversation Link Or Integrate Zoom Like Video Conferencing Application In My Laravel Project

Guys iam working with a student online exam management project. the project completed and moving well

staff will create exams, and student will login and write online exam and marks are evaluated and displayed in student login. everything worked fine.

Now what my client expecting is, need a video conferencing concept in the current application.

staff need to create a meeting and only that specific grade student need to attend the class which is like zoom

Kindly some one suggest a better idea for this please.

when i referred in google most of them said, BigBlueButton can be used for this, some of them suggested to use any package.

Kindly suggest a better link to satisfy my requirement please

Aug
29
2 months ago
Activity icon

Replied to The Stream Or File "/home/project/public_html/projectfolder/storage/logs/laravel.log" Could Not Be Opened: Failed To Open Stream: Permission Denied

@sergiu17 thank you for your response.

the same error.

actually,i had a backup in my local system, so what i did i created a new folder in cpanel and put the backup project. but that too shows the same error. this backup is took yesterday only. till yesterday eve it worked correctly..

Activity icon

Started a new Conversation The Stream Or File "/home/project/public_html/projectfolder/storage/logs/laravel.log" Could Not Be Opened: Failed To Open Stream: Permission Denied

guys iam working with a online student exam application.

i have hosted the application in cpanel and everything went fine. suddenly i face an error from today morning

The stream or file "/home/project/public_html/projectfolder/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php

it showing like this. through my cpanel terminal i did all the below

php artisan optimize
php artisan cache:clear
php artisan route:cache
php artisan view:clear
php artisan config:cache

composer dump-autoload

but still the same error. when i referred in google it show to restart the Apache or change the permission

but when i asked my server team they saying the permission is correct. it is a fault in laravel application only.

what i should do now??

this is my cpanel permission : https://imgur.com/DnFekGp

the application went smoothly. but from today morning its saying like this

do i need to check from my cpanel? do i need to check from my WHM? do i need to check in my laravel application?

kindly some one suggest your idea please

Aug
04
3 months ago
Activity icon

Replied to After A Long Time User Logout It Shows 419| Page Expired In Laravel

@jlrdw thank you for your response and sorry for very late reply.

actually what issue iam facing is students may write their exam 2 hrs some times 4 hrs also..

what students complaining is they often seeing the 419|page expired error. after choose answers for 200 questions when they click submit (4 hrs exam) their exam is not submitted, why?

is there any permanent solution that 419 page expire error should not come anywhere else in my application please,

i have changed my session.php like this

 'lifetime' => 35791394,


    'expire_on_close' => false,


my .env file like this

SESSION_LIFETIME=35791394

other than this what i should do for my session not to expire for long period.?? kindly suggest.

Jul
30
3 months ago
Activity icon

Replied to Alter Table From One To Many To Many To Many Relationship. But Almost 1000 Records Are Filled In The Table.

@silencebringer thank you so much ..

i have another small doubt actually i have 3 tables

RequestAssessment and AssessmentCreation

both the tables must share the chapter id with many to many relationship kindly can u suggest please.

what i planned now is t create a pivot table between RequestAssessment and chapter_details -> chapter_details_request_assessment

and

a pivot table between AssessmentCreation and chapter_details -> assessment_creation_chapter_details

is this correct ???

Activity icon

Replied to Alter Table From One To Many To Many To Many Relationship. But Almost 1000 Records Are Filled In The Table.

@silencebringer thank you for your response,

but what happens for the 1000 records.??? currently the table is with one to many relationship with 1000 records.. how i can handle that??

Activity icon

Started a new Conversation Alter Table From One To Many To Many To Many Relationship. But Almost 1000 Records Are Filled In The Table.

Iam working with a project online examination.

the process is assessment will be created and students will write the examination in online.

how the assessment is created staff will choose the class, section, subject, chapter and no. of questions.

this is my assessment creation table

id	class_id	subject_id	section_id	chapter_id

everything OK. almost 1000 assessments have gone. now my client expecting to give multiple chapter_id option.

for a single assessment there maybe multiple chapter. now how i can alter the table

currently my relationship is like this

my AssessmentCreation model

 public function chapterdetails()
    {
        return $this->belongsTo('App\ChapterDetails','chapter_id');
    }

My chapter model

public function assessmentdetails()
    {
        return $this->hasmany('App\AssessmentCreation','chapter_id');
    }

How i can change this?? kindly some one suggest please

Jul
24
4 months ago
Activity icon

Started a new Conversation Spatie-laravel-permission Shows Other Than The Given Permission Why ?

guys iam working with a project.

i have installed spatie/laravel-permission

everything worked fine

i followed this link : https://scotch.io/tutorials/user-authorization-in-laravel-54-with-spatie-laravel-permission

but whats the problem is

i have given like this in my nav bar

@can('Add Student')

                        <li><a href="{{ route('StudentAdmission.create') }}"> Add Student Admission</a></li>

     @endcan


its a school project, so for a staff i have give a role teacher and for teacher i have given the permission add student addmission.

but other than this everything is showing in the nav bar.

iam unable to find out, like this i did for other nav bars with other roles and permission the same issue.

for a specific role i have given few permissions but other than that permissions remaining are shown why?

Jul
21
4 months ago
Activity icon

Started a new Conversation After A Long Time User Logout It Shows 419| Page Expired In Laravel

guys iam working with laravel project online examination

when a student login and he is working with the application. if he was idle for a long time and when he clicks the logout button it shows like this 419|page expired

the url changes like this

www.project.com/logout

but eventhough i refresh the page the same error.

if i remove the logout in the url and if i click enter the application comes to the login page.

iam facing another issue too.

i have given the name of the user in the right corner like this {{ Auth::user()->name }} if a student or staff idle for long time and then when they refresh the page or when they click any nav bar or any button in the form it shows error

user()->name non object i know that the session expired so it shows like this.

what i expect is the system automatically should logout if session expires. else if user try to click some thing it should say your session expiired msg and it should logout how can i do that kindly some one help pelase

my session.php

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Session Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default session "driver" that will be used on
    | requests. By default, we will use the lightweight native driver but
    | you may specify any of the other wonderful drivers provided here.
    |
    | Supported: "file", "cookie", "database", "apc",
    |            "memcached", "redis", "dynamodb", "array"
    |
    */

    'driver' => env('SESSION_DRIVER', 'file'),

    /*
    |--------------------------------------------------------------------------
    | Session Lifetime
    |--------------------------------------------------------------------------
    |
    | Here you may specify the number of minutes that you wish the session
    | to be allowed to remain idle before it expires. If you want them
    | to immediately expire on the browser closing, set that option.
    |
    */

    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => false,

    /*
    |--------------------------------------------------------------------------
    | Session Encryption
    |--------------------------------------------------------------------------
    |
    | This option allows you to easily specify that all of your session data
    | should be encrypted before it is stored. All encryption will be run
    | automatically by Laravel and you can use the Session like normal.
    |
    */

    'encrypt' => false,

    /*
    |--------------------------------------------------------------------------
    | Session File Location
    |--------------------------------------------------------------------------
    |
    | When using the native session driver, we need a location where session
    | files may be stored. A default has been set for you but a different
    | location may be specified. This is only needed for file sessions.
    |
    */

    'files' => storage_path('framework/sessions'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Connection
    |--------------------------------------------------------------------------
    |
    | When using the "database" or "redis" session drivers, you may specify a
    | connection that should be used to manage these sessions. This should
    | correspond to a connection in your database configuration options.
    |
    */

    'connection' => env('SESSION_CONNECTION', null),

    /*
    |--------------------------------------------------------------------------
    | Session Database Table
    |--------------------------------------------------------------------------
    |
    | When using the "database" session driver, you may specify the table we
    | should use to manage the sessions. Of course, a sensible default is
    | provided for you; however, you are free to change this as needed.
    |
    */

    'table' => 'sessions',

    /*
    |--------------------------------------------------------------------------
    | Session Cache Store
    |--------------------------------------------------------------------------
    |
    | When using the "apc", "memcached", or "dynamodb" session drivers you may
    | list a cache store that should be used for these sessions. This value
    | must match with one of the application's configured cache "stores".
    |
    */

    'store' => env('SESSION_STORE', null),

    /*
    |--------------------------------------------------------------------------
    | Session Sweeping Lottery
    |--------------------------------------------------------------------------
    |
    | Some session drivers must manually sweep their storage location to get
    | rid of old sessions from storage. Here are the chances that it will
    | happen on a given request. By default, the odds are 2 out of 100.
    |
    */

    'lottery' => [2, 100],

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Name
    |--------------------------------------------------------------------------
    |
    | Here you may change the name of the cookie used to identify a session
    | instance by ID. The name specified here will get used every time a
    | new session cookie is created by the framework for every driver.
    |
    */

    'cookie' => env(
        'SESSION_COOKIE',
        Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
    ),

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Path
    |--------------------------------------------------------------------------
    |
    | The session cookie path determines the path for which the cookie will
    | be regarded as available. Typically, this will be the root path of
    | your application but you are free to change this when necessary.
    |
    */

    'path' => '/',

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Domain
    |--------------------------------------------------------------------------
    |
    | Here you may change the domain of the cookie used to identify a session
    | in your application. This will determine which domains the cookie is
    | available to in your application. A sensible default has been set.
    |
    */

    'domain' => env('SESSION_DOMAIN', null),

    /*
    |--------------------------------------------------------------------------
    | HTTPS Only Cookies
    |--------------------------------------------------------------------------
    |
    | By setting this option to true, session cookies will only be sent back
    | to the server if the browser has a HTTPS connection. This will keep
    | the cookie from being sent to you if it can not be done securely.
    |
    */

    'secure' => env('SESSION_SECURE_COOKIE', false),

    /*
    |--------------------------------------------------------------------------
    | HTTP Access Only
    |--------------------------------------------------------------------------
    |
    | Setting this value to true will prevent JavaScript from accessing the
    | value of the cookie and the cookie will only be accessible through
    | the HTTP protocol. You are free to modify this option if needed.
    |
    */

    'http_only' => true,

    /*
    |--------------------------------------------------------------------------
    | Same-Site Cookies
    |--------------------------------------------------------------------------
    |
    | This option determines how your cookies behave when cross-site requests
    | take place, and can be used to mitigate CSRF attacks. By default, we
    | do not enable this as other CSRF protection services are in place.
    |
    | Supported: "lax", "strict", "none"
    |
    */

    'same_site' => null,

];



Activity icon

Replied to My Laravel Application Cant Handle 1000 Users Simultaneously. Site Cant Be Reached Error When Trying To Login Simultaneously

@martinbean thank you thank you for your response.

but actually in shared hosting the same worked well for 700 students that make me to doubt, may be due to images this fault occur??

regarding db iam using models only, iam using eloquent queries only. my tables has relationships. beyond that what i should do?

@jlrdw thank you for your response.

can i have more than one database for a single project. can i make relationsip among tables?? but currently now the table has 4 lakh records how i can restructure the table now??

@tinfoilman thank you for your response.

my problem is 1 week back everthing worked fine with shared hosting with just 4 gb ram i think so, and there are 3 lakhs record. 700 students wrote the exam well.

Most of the suggested me to test my project load testing using jmeter. is this correct??

what kind of steps next i need to take??

today what happened is my client said to remove all the images. so i took backup and removed all the images almost 1 gb.

today simultaneously 400-500 students wrote the exam. nothing happened, everthing worked fine. students wrote the exam very well

iam unable to track where the problem is

1)whether its my application 2)whether its my db 3)whether its my server 4)whether its my project size or something else

kindly respond any ideas please.. i need to sort out this problem this week itself..

Jul
20
4 months ago
Activity icon

Started a new Conversation My Laravel Application Cant Handle 1000 Users Simultaneously. Site Cant Be Reached Error When Trying To Login Simultaneously

Guys iam working with laravel project. its a online examination application.

first i have hosted my application in shared hosting. simultaneously 700 students wrote the exam well. past june month full the exam conducted daily. daily 700 students will write exam. everything went fine.

3 days back the school had added further 500 students. now the strength is 1200 students. so we opted to vps server. 4 gb ram and 1 TB hard disk. when all the 1200 students simultaneously tried to login the application yesterday. none of the student cant reach the site.

it showed error

Site cant be reached . 
xyz.com  took too long  to respond
ERR_CONNECTION_TIMED_OUT

so we opted to dedicated server. the configuration is

CPU: Intel Xeon Processor E3-1271 v3 
RAM: 30GB DDR3 RAM 
HDD: 2TB HDDx2 RAID 1 
Bandwidth: 2 TB 

but today student started the same process once again the same problem occured. site cant be reached error.

when i chatted with my support what they said is to optimize the application.

let me explain my configuration first.

my laravel version

Laravel Framework 6.18.0

my project folder inside the server is 150 mb only but images are stored in the storage folder. it takes 600mb (zip format). all the question and answers have example image. so image size is 600mb (in zip state). if i unzip it , then it takes 1 gb above

My DB size image: https://imgur.com/MY84uiV

my db size is : 50 mb with 443231 total rows and 23 tables. and engine is innoDB

What i did to optimize my project is

Route::get('/cc', function () {
    Artisan::call('cache:clear');
    echo '<script>alert("cache clear Success")</script>';
});


Route::get('/ccc', function () {
    Artisan::call('config:cache');
    echo '<script>alert("config cache Success")</script>';
});


Route::get('/vc', function () {
    Artisan::call('view:clear');
    echo '<script>alert("view clear Success")</script>';
});


Route::get('/cr', function () {
    Artisan::call('route:cache');
    echo '<script>alert("route clear Success")</script>';
});


Route::get('/coc', function () {
    Artisan::call('config:clear');
    echo '<script>alert("config clear Success")</script>';
});

Route::get('/storage123', function () {
    Artisan::call('storage:link');
    echo '<script>alert("linked")</script>';
});

so ```xxz.com/cc`` if i give like this cache will be cleared. like that i will give.

other than that i used eloquent queries in all controller. i didnt use any raw queries.

But even in this dedicated server 500 students cant access it why?? is there anything to do.

few of my friends said to change the db engine from innoDB to mariaDB so that it follows many request is that correct?? do i need to do that??

or else do i need to make the login process some what different by sequential request??

but 5 days back in shared hosting 700 students attended the exam well.

iam unable to predict whats happening?? kindly some one help please.

i didnt done any testing.. what kind of testing i should do?? for that testing what should i do?

most of them said to regulate the concurrent user. but how to do that??

my server team said that, the y increased our appache limit to 1000 and execution process to 1000. but these all i didnt do in shared hosting.

i dont know what to do kindly some one suggest all your ideas please.

Jul
17
4 months ago
Activity icon

Replied to Call To Undefined Method Maatwebsite\Excel\Excel::load() Laravel Uploading With Excel Data Into Table

@deepu07 @marianomoreyra thank you guys thank you so much

the issue is i have empty sheets in my excel thats why it not worked.

what i did is

foreach ($collection as $row) {
            if ($row->filter()->isNotEmpty()) {
                $addstudent = new StudentRegistration([
                'login_user_id' => auth()->id(),
                'school_id' => $this->data['school_id'],
                'class_id' =>$this->data['class_id'],
                'section_id' => $this->data['section_id'],
                'stud_name' => $row[0],
                'stud_email' =>"-",
                'stud_phno' =>null,
                'stud_type' =>"-",
                'stud_father' => "-",
                'stud_mother' => "-",
                'stud_id' => $row[1],
                'stud_status' => "active",
            ]);

                $addstudent->save();

                $addstudent->user()->create(
                    ['name' => $row[0],
                'username' => $row[1],
                'user_type' => "student",
                'password' =>  $row[2],
                'status' => "active"
            ]
                );
            }
        }

    }


i added this line if ($row->filter()->isNotEmpty()) and it worked for me thank you guys

Activity icon

Replied to 419|page Expired Error When Trying To Login

@jeffreyvanrossum thank you

i check the csrf toke the values are changing in normal browser and incognito ..

i have these codings in my route

Route::get('/cc', function () {
    Artisan::call('cache:clear');
    echo '<script>alert("cache clear Success")</script>';
});
Route::get('/ccc', function () {
    Artisan::call('config:cache');
    echo '<script>alert("config cache Success")</script>';
});
Route::get('/vc', function () {
    Artisan::call('view:clear');
    echo '<script>alert("view clear Success")</script>';
});
Route::get('/cr', function () {
    Artisan::call('route:cache');
    echo '<script>alert("route clear Success")</script>';
});
Route::get('/coc', function () {
    Artisan::call('config:clear');
    echo '<script>alert("config clear Success")</script>';
});
Route::get('/storage123', function () {
    Artisan::call('storage:link');
    echo '<script>alert("linked")</script>';
});


so i cleared the the cache, route, confiq etc till not working please any suggestion

Activity icon

Replied to 419|page Expired Error When Trying To Login

@jeffreyvanrossum its not moving to the login controller. even i ginve wrong username and password it just says 419|page expired only

Activity icon

Replied to 419|page Expired Error When Trying To Login

@jeffreyvanrossum thank you so much for your response

how to check that

Activity icon

Started a new Conversation 419|page Expired Error When Trying To Login

guys working with online examination project. simultaneously 3000 students will write the exam.

till yesterday the application worked fine. but today when student try to login they face this issue

419|page expired

why this happens??

this is my route file

Auth::routes();

Route::get('logout', '\App\Http\Controllers\Auth\[email protected]');

Route::get('/', '[email protected]')->name('home');

this is my login form

  <form class="md-float-material form-material" method="POST" action="{{ route('login') }}">
        {{ csrf_field() }}
        <div class="agile-field-txt">
            <input type="text" name="username" placeholder="username" />
        </div>
        <div class="agile-field-txt">
            <input type="password" name="password" placeholder="Password" required="" id="myInput" />
        </div>
      
        <div class="w3ls-bot">
            <input type="submit" value="LOGIN">
        </div>
    </form>

this is my config/session.php

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Session Driver
    |--------------------------------------------------------------------------
    |
    | This option controls the default session "driver" that will be used on
    | requests. By default, we will use the lightweight native driver but
    | you may specify any of the other wonderful drivers provided here.
    |
    | Supported: "file", "cookie", "database", "apc",
    |            "memcached", "redis", "dynamodb", "array"
    |
    */

    'driver' => env('SESSION_DRIVER', 'file'),

    /*
    |--------------------------------------------------------------------------
    | Session Lifetime
    |--------------------------------------------------------------------------
    |
    | Here you may specify the number of minutes that you wish the session
    | to be allowed to remain idle before it expires. If you want them
    | to immediately expire on the browser closing, set that option.
    |
    */

    'lifetime' => env('SESSION_LIFETIME', 120),

    'expire_on_close' => false,

    /*
    |--------------------------------------------------------------------------
    | Session Encryption
    |--------------------------------------------------------------------------
    |
    | This option allows you to easily specify that all of your session data
    | should be encrypted before it is stored. All encryption will be run
    | automatically by Laravel and you can use the Session like normal.
    |
    */

    'encrypt' => false,

    /*
    |--------------------------------------------------------------------------
    | Session File Location
    |--------------------------------------------------------------------------
    |
    | When using the native session driver, we need a location where session
    | files may be stored. A default has been set for you but a different
    | location may be specified. This is only needed for file sessions.
    |
    */

    'files' => storage_path('framework/sessions'),

    /*
    |--------------------------------------------------------------------------
    | Session Database Connection
    |--------------------------------------------------------------------------
    |
    | When using the "database" or "redis" session drivers, you may specify a
    | connection that should be used to manage these sessions. This should
    | correspond to a connection in your database configuration options.
    |
    */

    'connection' => env('SESSION_CONNECTION', null),

    /*
    |--------------------------------------------------------------------------
    | Session Database Table
    |--------------------------------------------------------------------------
    |
    | When using the "database" session driver, you may specify the table we
    | should use to manage the sessions. Of course, a sensible default is
    | provided for you; however, you are free to change this as needed.
    |
    */

    'table' => 'sessions',

    /*
    |--------------------------------------------------------------------------
    | Session Cache Store
    |--------------------------------------------------------------------------
    |
    | When using the "apc", "memcached", or "dynamodb" session drivers you may
    | list a cache store that should be used for these sessions. This value
    | must match with one of the application's configured cache "stores".
    |
    */

    'store' => env('SESSION_STORE', null),

    /*
    |--------------------------------------------------------------------------
    | Session Sweeping Lottery
    |--------------------------------------------------------------------------
    |
    | Some session drivers must manually sweep their storage location to get
    | rid of old sessions from storage. Here are the chances that it will
    | happen on a given request. By default, the odds are 2 out of 100.
    |
    */

    'lottery' => [2, 100],

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Name
    |--------------------------------------------------------------------------
    |
    | Here you may change the name of the cookie used to identify a session
    | instance by ID. The name specified here will get used every time a
    | new session cookie is created by the framework for every driver.
    |
    */

    'cookie' => env(
        'SESSION_COOKIE',
        Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
    ),

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Path
    |--------------------------------------------------------------------------
    |
    | The session cookie path determines the path for which the cookie will
    | be regarded as available. Typically, this will be the root path of
    | your application but you are free to change this when necessary.
    |
    */

    'path' => '/',

    /*
    |--------------------------------------------------------------------------
    | Session Cookie Domain
    |--------------------------------------------------------------------------
    |
    | Here you may change the domain of the cookie used to identify a session
    | in your application. This will determine which domains the cookie is
    | available to in your application. A sensible default has been set.
    |
    */

    'domain' => env('SESSION_DOMAIN', null),

    /*
    |--------------------------------------------------------------------------
    | HTTPS Only Cookies
    |--------------------------------------------------------------------------
    |
    | By setting this option to true, session cookies will only be sent back
    | to the server if the browser has a HTTPS connection. This will keep
    | the cookie from being sent to you if it can not be done securely.
    |
    */

    'secure' => env('SESSION_SECURE_COOKIE', false),

    /*
    |--------------------------------------------------------------------------
    | HTTP Access Only
    |--------------------------------------------------------------------------
    |
    | Setting this value to true will prevent JavaScript from accessing the
    | value of the cookie and the cookie will only be accessible through
    | the HTTP protocol. You are free to modify this option if needed.
    |
    */

    'http_only' => true,

    /*
    |--------------------------------------------------------------------------
    | Same-Site Cookies
    |--------------------------------------------------------------------------
    |
    | This option determines how your cookies behave when cross-site requests
    | take place, and can be used to mitigate CSRF attacks. By default, we
    | do not enable this as other CSRF protection services are in place.
    |
    | Supported: "lax", "strict", "none"
    |
    */

    'same_site' => null,

];

this is the link: nissimax.com/Student-Login-Page

when i click this it changes like this https://www.nissimax.com/Student-Login-Page/login

everthing is ok. now i gave the login details and i pressed login button it shows 419|page expired error

why??

this is my login controller


<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\User;
use Alert;
use Session;
use App\AcademicYear;
use Illuminate\Validation\Rule;

use Auth;

class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    public function login(Request $request)
    {

        if (auth()->attempt(request(['username', 'password'])) == true ) {

            return redirect()->route('home');
        }

        else {

      
            return back()->withErrors([
      'message' => 'The email or password is incorrect, please try again',
     ]);
        }
    }

   

}


what may be the issue.

when i googled it most of them said to add csrf token. i have the csrf token. but still didnt work. i hve the csrf token in my login form.

i have a logout function so what i did is nissimax.com/Student-Login-Page/logout it redirected to login page. then i tried to login but the same error.

i changed my browser, checked in incognito mode. also gave

php artisan cache clear, optimize, view clear, route clear everything.

but not working. please some one help pleaseee

Jul
14
4 months ago
Activity icon

Replied to Call To Undefined Method Maatwebsite\Excel\Excel::load() Laravel Uploading With Excel Data Into Table

@deepu07 thank you for your response .

this is my controller

 $data=$request->all();        

           $filenaeeee = $request->file('student_excel_file');

           Excel::import(new BukStudentsImport($data),  $filenaeeee);

i tired like this. this is my BukStudentsImport


<?php

namespace App\Imports;

use App\StudentRegistration;
use App\User;
use Illuminate\Support\Collection;
use Maatwebsite\Excel\Concerns\ToCollection;

class BukStudentsImport implements ToCollection
{

    // public function  __construct($data)
    // {
    //     // dd($cartage);
    //     $this->data = $data;
    // }

    /**
     * @param Collection $collection
     */
    public function collection(Collection $collection)
    {

        foreach ($collection as $row) {

         $addstudent = new StudentRegistration([
                'login_user_id' => auth()->id(),
                'school_id' => $this->data['school_id'],
                'class_id' => $this->data['class_id'],
                'section_id' => $this->data['section_id'],
                'stud_name' => $row[0],
                'stud_email' => "-",
                'stud_phno' => 123,
                'stud_type' => "-",
                'stud_father' => "-",
                'stud_mother' => "-",
                'stud_id' => $row[1],
                'stud_status' => "active",
            ]);

             $addstudent->save();

            dd("STOP inserted");

            $addstudent->user()->create(
                ['name' => $row[0],
                    'username' => $row[1],
                    'user_type' => "student",
                    'password' => $row[2],
                    'status' => "active",
                ]);

        
        }
    }
}


But its not working. i can see the stop message id dd(). but the data is not inserted. why????

Activity icon

Replied to Merge Student Mark With Student Data In Collection After Calculation

@michaloravec sorry for late response thank you thank you soo much for your response.

worked great with your answer. kindly if possible refer this also pelase

Link:

https://laracasts.com/discuss/channels/eloquent/call-to-undefined-method-maatwebsiteexcelexcelload-laravel-uploading-with-excel-data-into-table

please

Activity icon

Started a new Conversation Call To Undefined Method Maatwebsite\Excel\Excel::load() Laravel Uploading With Excel Data Into Table

guys working with online exam project. i need to add students data bulk.

so i planned to using maatwebsite/excel

i saw composer show in my gitbash it showed like below.

maatwebsite/excel                     3.1.19    Supercharged Excel exports...

but in my composer.json

  "require": {
        "php": "^7.2",
        "barryvdh/laravel-dompdf": "^0.8.6",
        "fideloper/proxy": "^4.0",
        "filp/whoops": "^2.7",
        "intervention/image": "^2.5",
        "laravel/framework": "^6.2",
        "laravel/tinker": "^2.0",
        "realrashid/sweet-alert": "^3.1",
        "spatie/laravel-permission": "^3.11",
        "uxweb/sweet-alert": "^2.0",
        "yajra/laravel-datatables-buttons": "^4.0",
        "yajra/laravel-datatables-editor": "^1.19",
        "yajra/laravel-datatables-fractal": "^1.5",
        "yajra/laravel-datatables-html": "^4.22",
        "yajra/laravel-datatables-oracle": "^9.8"

    },

My first confusion is whether that package is there are not in my project?

next i tried to upload excel data this is my coding

  $this->validate($request, [
            'student_excel_file'  => 'required|mimes:xls,xlsx'
           ]);       

           $path = $request->file('student_excel_file')->getRealPath();       

           $data = Excel::load($path)->get();

           dump( $data);

this shows error

Call to undefined method Maatwebsite\Excel\Excel::load()

when i google most of them said in maatwebsite version 3 and above load is depreciated. so most of them said to switch back to version 2. iam unable to do.

i ran composer remove maatwesbite/excel. but i cant see it in composer.json. but still the package exist. what should i do??

let me say my process. i need to get student_name, student_username, student_password from form and it will be stored in StudentRegistration table and then it is stored in user table with userprofile as polymorph table

this is my coding

$data = $request->all();
        foreach ($data['student_name'] as $i => $name) {
            $addstudent = new StudentRegistration([
                'login_user_id' => auth()->id(),
                'school_id' => $request->school_id,
                'class_id' => $request->class_id,
                'section_id' => $request->section_id,
                'stud_name' => $name,               
                'stud_status' => "active",
            ]);
            $addstudent->save();

            $addstudent->user()->create(
                ['name' => $name,
                'username' =>  $data['username'][$i],
                'user_type' => "student",
                'password' =>  $data['password'][$i],
                'status' => "active"
            ]);
        }

      alert()->success('Student Added Successfully');


Now i need to do the same process from excel sheet.. how can i do that

i referred this link for uploading using excel sheet: https://www.webslesson.info/2019/02/import-excel-file-in-laravel.html

kindly some one suggest please..

Jul
10
4 months ago
Activity icon

Started a new Conversation Merge Student Mark With Student Data In Collection After Calculation

this is a online examination project. i have a query which gets student detail with his answers from sub table.

// this fetches all  records from studentexammain table and his answers from sub table
$studentexams= StudentExamMain::with('studentexamsubdetails')->where('assessment_id', $id)->get();




// looped over the student to find his mark
foreach ($studentexams as $studentexam) {

$totalmark=0;   //declared a variable to calcuate the total mark

foreach ($studentexam->studentexamsubdetails as $question) {   //// iterating the single student with his answers

$range=0;      // declared a varibe to calculate percentage

if ($question->stud_answer==$question->questiondetails->correct_answer) {   // checking the if condition if answer from question table and answer of the student matches add 1 point. 

$totalmark=$totalmark + 1;
}
}
$range=($totalmark/($ttquestions * $details->mark_per_ques))*100;      // calculating the percentage for that single student.

dd($studentexam);    //for this i have given the output below


$megeddata[]=array_merge($studentexam->toArray(), ['markrange' => $range]);    //for this i have given the output below



everything is ok now i need to merge the student mark with his collection so that i can use it in blade file 


currectly i dd ($studentexam) after the range calculation

App\StudentExamMain {#2216 ▼
  #connection: "mysql"
  #table: "student_exam_mains"
  #primaryKey: "id"
  #keyType: "int"
  +incrementing: true
  #with: []
  #withCount: []
  #perPage: 15
  +exists: true
  +wasRecentlyCreated: false
  #attributes: array:10 [▼
    "id" => 783
    "assessment_id" => 29
    "class_id" => 12
    "section" => "A"
    "student_id" => 312
    "status" => "active"
    "result_status" => "1"
    "exam_desc" => null
    "created_at" => "2020-06-16 16:13:22"
    "updated_at" => "2020-06-17 15:48:48"
  ]
  #original: array:10 [▶]
  #changes: []
  #casts: []
  #dates: []
  #dateFormat: null
  #appends: []
  #dispatchesEvents: []
  #observables: []
  #relations: array:1 [▶]
  #touches: []
  +timestamps: true
  #hidden: []
  #visible: []
  #fillable: []
  #guarded: array:1 [▶]
}

Now i need to add the add the range which is calculated for his in his collection. what i did is i added this code

$megeddata[]=array_merge($studentexam->toArray(), ['markrange' => $range]);

now afrer the forloops i dd($megeddata) it looked like this

array:44 [▼
  0 => array:12 [▼
    "id" => 783
    "assessment_id" => 29
    "class_id" => 12
    "section" => "A"
    "student_id" => 312
    "status" => "active"
    "result_status" => "1"
    "exam_desc" => null
    "created_at" => "2020-06-16 16:13:22"
    "updated_at" => "2020-06-17 15:48:48"
    "studentexamsubdetails" => array:30 [▶]
    "markrange" => 30.0
  ]
  1 => array:12 [▶]
  2 => array:12 [▶]
  3 => array:12 [▶]
  4 => array:12 [▶]
  5 => array:12 [▶]
  6 => array:12 [▶]
  7 => array:12 [▶]
  8 => array:12 [▶]
  9 => array:12 [▶]
  10 => array:12 [▶]
  11 => array:12 [▶]
  12 => array:12 [▶]
  13 => array:12 [▶]
  14 => array:12 [▶]
  15 => array:12 [▶]
  16 => array:12 [▶]
  17 => array:12 [▶]
  18 => array:12 [▶]
  19 => array:12 [▶]

everything is ok. but icant call the values

see i did like this

 foreach ($megeddataas $data1){


        dump($data1->markrange);     // this not working showing error markrange is non object

        dump($data1['markrange']);    .. this works fine. 


}

what can i do? someone help please. if i use $data1['markrange'] how i can use my model name in blades say for example $data1->user->username this not works i think so.

kindly some one help please

Jul
09
4 months ago
Activity icon

Started a new Conversation Sorting The Student Mark Which Is Calculated In The Laravel Blade File Using Php

guys i am working with a project student online examination

i have two tables to store the student answer. first table stores student name and assessment_id and the second table stores the answers of the particular student

StudentExamMain - >stores student_id, assessment_id, exam_date

StudentExamSub -> stores the studentexammain_id, stud_answer

my controller query

 $studentexams= StudentExamMain::with('studentexamsubdetails')->where('assessment_id', $id)->get();

iam calculating the student mark in the blade file like below


@foreach ($studentexams as $studentexam) // iterating students one by one

@php $totalmark=0;@endphp  //declared a variable to calcuate the total mark

@foreach($studentexam->studentexamsubdetails as $answers) // iterating the single student with his answers

@php $range=0; @endphp  // declared a varibe to calculate percentage

@if($answers->stud_answer==$question->questiondetails->correct_answer) // checking the if condition if answer from question table and answer of the student matches add 1 point. 

@php $totalmark=$totalmark + 1; @endphp

@endif

@endforeach

@php $range=($totalmark/30)*100 @endphp  // calculating the percentage for that single student.

@endphp

Everything works fine. but i need to sort the data in descending order with mark. those who got high mark should be displayed first.

currently my output coding like this

<div class="progressBar">

    <h4>{{ $studentexam->user->name  }} ({{ $studentexam->user->username }}) -
        {{ number_format($range,2) }} % </h4>

</div>


// my output screen looks like this for the above coding

Abdul (A001) - 62 %

Bazith (B002) - 80 %

Imran (I001) - 52 %

Muki (M002) - 90 %

Rahman (R002) - 96 %

i got everything i expected. but i need to sort the students based on the mark. top ark should come first in descending order.

kindly some one help please..

Jul
01
4 months ago
Activity icon

Replied to Symlink() Has Been Disabled For Security Reasons

@niyo you are saying that you stored your images in storage folder and used symlink in local system. but u cant do that in shared hosting am i right??

why cant you do like this

in your route

Route::get('/StorageLink', function () {
    Artisan::call('storage:link');
    echo '<script>alert("linked")</script>';
});

Now run your project say for example xyz.com you can do like this xyz.com/StorageLink then it will make a symlink in live..

Jun
18
5 months ago
Activity icon

Replied to How To Generate Charts Using Barryvdh/laravel-dompdf And Make It Report

@bobbybouwmann but i need a package that must work in shared hosting with using css and js.

when i referred in google most of them said barryvdh/laravel-dompdf will support css. but not all the css tags only a few tags.

but iam having progress bar, etc. do u have any idea ?? any package that must run in local system and live server with css and js???

my client expecting charts, student mark in progress bar?? all these how can i do?? i was so confused, past one week iam suffering to get this pdf issue.

till these days what i did is i used snapey pdf in my local and daily i will take printout and mail them. but how long i can do this, i need to give print permission to them

i will show my expectation also.

image: https://imgur.com/01e3bjQ

please check this image and please suggest me a best package.. plz

Jun
17
5 months ago
Activity icon

Replied to How To Generate Charts Using Barryvdh/laravel-dompdf And Make It Report

@bobbybouwmann

kindly please suggest any package. that need to support external css and js files.

still now i cant get any idea please..

you suggested Browsrshot but i need to fetch few data from db. i will list all the names in the screen and then i will check few students and then will take pdf. i think this is not possible in BrowserShot.

Kindly please suggest any package

Activity icon

Replied to How To Use Barryvdh/laravel-snappy Package In Live Server Cpanel

@bobbybouwmann kindly please suggest any package. that need to support external css and js files.

still now i cant get any idea please..

you suggested Browsrshot but i need to fetch few data from db. i will list all the names in the screen and then i will check few students and then will take pdf. i think this is not possible in BrowserShot.

Kindly please suggest any package

Activity icon

Replied to Remove A Package From Laravel In Live Server Issue

@fylzero thank you for your response. ya did and it worked.

Now i need the pdf package which will be better package that need to support external css and js files

barryvdh/laravel-snappy this i cant use in server

kindly suggest please

Activity icon

Started a new Conversation Remove A Package From Laravel In Live Server Issue

i have installed barryvdh/laravel-snappy in my local system and everything worked fine.

and my wkhtmltopdf path is:

'binary' => '"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf"'

but i cant work with images why? and i tried to use this package in live shared hosting so i copied the vendor config folders in live.

but due to this path issue it showed error. so now i planned to use some other package, now how i can remove this package from live? kindly some one suggest.

Note:

at first i use DOM/pdf. that gave me correct format. but i need to add external css and js files. because for reports i need progress bar, charts, graphs. i started installing

barryvdh/laravel-snappy

but now i dont know which package i should use, and which will support css, js files..

some one suggest please

Jun
16
5 months ago
Activity icon

Replied to Fetch Students From User Table Who Not Wrote Specific Exam(where Comdtion) In Exam Table To Get The Absent List

@michaloravec thank you soo much. and sorry for delay. the given code worked perfectly..

thank you. if possible kindly answer my other threads please..

Jun
13
5 months ago
Activity icon

Started a new Conversation Chrome Not Supporting Maths Equations Why?

iam using tinymce with wiris installed.

iam trying to work with maths equation, it works in firefox but not in chrome.

when i enter root 2 in mozilla firefox it works fine as expected. but in chrome just it showing only 2 why??

kindly some one help please

Activity icon

Started a new Conversation Where The Images Uploaded In Tinymce Are Stored? And In What Format It Is Stored?

Guys iam working with online examination project.

As it was an examination based project teachers need to store the question in database.The question is not a pure text format. the question may contain half text, half image, half maths physics equation etc. so the question is mixture of images, texts, tables, equations formulae etc. for this i need an editor to add this. when i referred in google i found tinymce is best.

In what format the image is stored in db?? is there any file location?

few of my friends said it is stored in the table column as base64 (for images) and html entitied. is this right?? else we need to give path to the file location??

1)how to integrate tinymce in my project.

init-tinymce.js

tinymce.init({
    selector: 'textarea.tinymceeditor',

    plugins: ['advlist autolink lists link image charmap print preview anchor', 'searchreplace visualblocks code fullscreen', 'insertdatetime media table paste code help wordcount', ],

    external_plugins: {
        tiny_mce_wiris: 'https://www.wiris.net/demo/plugins/tiny_mce/plugin.js'
    },

    toolbar: 'tiny_mce_wiris_formulaEditor',
});

my header page

<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>

<script type="text/javascript" src="{{ URL::asset('tinymce/init-tinymce.js') }}"></script>

so after i done all these i can see the editor in my web form everything is fine. But i need to add the bold word, italic word, images equations everything in database for that i need to make the column anything?? means now the column is in data type

is this format right? or do i need to change the question_description column data type to some other in the table?

if everything goes to database whether it will be retrieved correctly? do i need to do something else in my code? if i insert an image how it will be stored in db, where it will be stored, how it will be retrieved?

i need maths equation in my project so that i referred google and i added wiris plugin

external_plugins: { tiny_mce_wiris: 'https://www.wiris.net/demo/plugins/tiny_mce/plugin.js' },

how to integrate a text editor in my project?

whether i need to change the database column into any datatype? whether the mixture of question will be stored in db correctly? how it is retrieved in the view form? need math equation?

Jun
12
5 months ago
Activity icon

Started a new Conversation Integrated Wiris Plugin With Tinymce. But Square Root And Some Special Characters Are Not Correctly Saved In Db

Guys iam working with online examination project.

i have integrated wiris plugin with tinymce for maths equations. everything gone well, but after that while using square root it works fine, but when it saves in db it gets wrong why?

To integrate i used


    <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>

    <script>tinymce.init({
        selector:'textarea.tinymce-editor',

        external_plugins: { tiny_mce_wiris: 'https://www.wiris.net/demo/plugins/tiny_mce/plugin.js' },

        plugins: [
        'advlist autolink lists link image charmap print preview anchor',
        'searchreplace visualblocks code fullscreen',
        'insertdatetime media table paste code help wordcount',

      ],
toolbar:['tiny_mce_wiris_formulaEditor','tiny_mce_wiris_formulaEditorChemistry'],

        });</script>

My screen shot: this is the equation screen: https://imgur.com/2scgjrv this screen works fine

in this screen i included the formula in my editor: https://imgur.com/OSUWOki that too worked fine.

after that i have javascript to preview the data. i used this code to preview it

 document.getElementById("desc_ques").innerHTML=tinyMCE.get('ques_desc').getContent();
         $('#image_ques').attr('src', $('#ques_image').attr('src'));

screen: https://imgur.com/iS5tFdD

in this the square root is missed why??

and in database also it not saved correctly. Whats the problem but the pi, epsion and other symbols printed correctly. you may see the screen shots.

in this same format it stored in database

Kindly some one suggest any idea please..

Jun
11
5 months ago
Activity icon

Replied to How To Get Maths And Physics Equations In Tinymce?

@braunson thank you so much for your response.

actually my clients will type the equation in word or excel then they will copy it to this tinymce editor.

its is copied as image and stored somewhat in a format of base64 i dont know why.

i reffered this link http://www.wiris.com/en/solutions/tinymce already. but whats my problem is,

that equations are converted as image why? i cant store the equation as text? ok if i store the equation as image how can i retrieve it??

Activity icon

Started a new Conversation How To Get Maths And Physics Equations In Tinymce?

guys iam working with a school project online examination.

i have a form to enter questions. i have tinymce editor to enter the questions.

i need to enter maths question with equations. how it is possible in tinymce.

i have the equations in word document. if i copy and paste that in my tinymce it changes like broken image

whats the problem kindly some one suggest how to add equations in tinymce else is there any alternate way any other editors.

〖Ax〗^2 〖+Bxy+Cy〗^2+Dx+Ey+F=0 this is my equation. even here too its not formatted correctly.

Ax square + Bxy + Cy square + Dx + Ey + F= 0 this is my equation explanation

Kindly some one help

Jun
10
5 months ago
Activity icon

Replied to How To Generate Charts Using Barryvdh/laravel-dompdf And Make It Report

@bobbybouwmann then you are saying that barryvdh/laravel-dompdf will support css and js if path is correct??

kindly suggest any solution for local images loading and in live server also?

Jun
09
5 months ago
Activity icon

Replied to Calculate How Many Students Answered This Question With This Answer In Eloquent

@tray2 @gopalsharma thank you guys for your response.

My StudentExamMain Model

  public function studentexamsubdetails()
    {
        return $this->hasmany('App\StudentExamSub', 'exam_main_id');
    }

My StudentExamSub Model

   public function studentexammaindetails()
    {
        return $this->belongsTo('App\StudentExamMain', 'exam_main_id');
    }

My AssessmentMain model

  public function assessmentsubdetails()
    {
        return $this->hasmany('App\AssessmentSub','assessment_id');
    }


    public function studentassessments()
    {
        return $this->hasMany('App\StudentExamMain','assessment_id');
    }

My AssessmentMain table with columns

id	name	mark_per_question duration date
1	A1		5					60mins
2	A2		2					20mins

My StudentExamMain Table

id	assessment_id	student_id	result_status
1	1				1			0
2	1				2			0
3	1				3			0
.
.
.
30	1				30			0

Total 30 students in user table. and 30 student wrote the exam. their answers for each question is given in StudentExamSub table

My StudentExamSub Table contains

id	main_exam_id	question_id	student_answer
1	1				1				A
2	1				2				B
3	1				3				D
4	1				4				A
5	1				5				C
.
.
50	1				50				A

Total 50 questions. so student 1 has answered all the 50 questions. Now i need to check how many right and how many wrong. if a question is right then mark_per_question must be multipled with it.

My QuestionDetails Model

  public function studentExamsub()
    {
        return $this->hasMany('App\StudenExamSub', 'question_id');
    }

My StudentExamSub model

 public function questiondetails()
    {
        return $this->belongsTo('App\QuestionDetails','question_id');
    }

so what i did is

   $studentexams = StudentExamMain::with('studentexamsubdetails')->where('assessment_id', 2)->get();

in my Blade file

  @foreach ($studentexams as $studentexam)  //loop the array. get the first student and move inside

                                @php $totalmark=0;@endphp	//declared a varaible to save totalmark of a single student

                                @php $totalques=0;@endphp	//declared a varaible to calculate total questions

                                @foreach($studentexam->studentexamsubdetails as $question) // loop to run answers of first student

                                @php $range=0; @endphp 

                                @php $totalques=$totalques+1; @endphp 

                                @if($question->student_answer==$question->questiondetails->correct_answer) //checking the answers of each question written by student with correct answer in QuestionDetails table

                                @php $totalmark=$totalmark+1; @endphp // if it is correct increment to 1. but here i need to multiply the mark_per_question with correct answer. and also mark should display is descending or ascending order.

                                @endif

                                @endforeach

                                @php $range=($totalmark/$totalques)*100 @endphp


{{ $studentexam->user->name  }}// display student name

 {{ number_format($range,2) }} // display mark calculated to 100%

@endforeach


this query works fine. but i know this is too long process. iam collapsing myself. can i do all the process in controller and and just pass the values alone.

my expected output


Tray- 98%
gopalsjarma- 86%
Abdul- 85%
Andrews- 70%

.
.
.
.
.
like this in descending order i need the output


Kindly help pleasee
Activity icon

Replied to Multiple Foreign Key Indicating One Primary Key And Getting Values From Table

@tray2 i have another small doubt,

i will create a pivot table lie this

assessment_details_subject_details with columns

id	assessment_id	subject_id
1	1				1
2	1				2
3	1				3

so here for assessment_id 1 it has three subjects. ok fine. Now whats my query i have a questionDetails table with columns

id	subject_id  chapter_id	q.no   ques_description
1	1		1	Q1		----
2	1		1	Q2		---
3	2		1	Q3	          ---
``

so iam expecting a query like this

fetch questions from question table where subject_id = subject_ids given in the pivot table for that specific assessment```assessment_details_subject_details```

i think you understood the question.kindly reply for this please,
Activity icon

Replied to Fetch Students From User Table Who Not Wrote Specific Exam(where Comdtion) In Exam Table To Get The Absent List

@tray2 @michaloravec thank you so much guys for your response.

i did like this and i got the solution.. whether this is right??

   $absentees = User::where('user_type','student')->doesntHave('studentuser', 'and', function($query) use ($request){
            $query->where('assessment_id', $request->assessment_id);
        })->orderBy('id','asc')->get();

fetch records from user table where user_type= student and check those students have records in 'studentuser' model for the assessment_id=$request->assessment_id

i have my relation like this User Model

  public function userprofile()
    {
        return $this->morphTo();
    }

    public function studentuser()
    {
        return $this->hasMany('App\StudentExamMain', 'student_id');
    }

My studentExamMain model

 public function user()
    {
        return $this->belongsTo('App\User', 'student_id');
    }

  public function assessmentmaindetails()
    {
        return $this->belongsTo('App\AssessmentCreationMain','assessment_id');
    }

But this query gives correct result. and my doubt is, i need to write a query for polymorphic relation.


$students=User::where('user_type','student')->WhereHas('userprofile', function ($query) use ($request) {
                $query->where([//      
         ['class_id',  $request->class_id],
         ['section',   $request->section_id],
     ]);
        })->doesntHave('studentuser', 'and', function($query) use ($request){
            $query->where('assessment_id', $request->assessment_id);
        })->orderBy('id','asc')->get();


for polymorphic i used like this and it showed error

Please use whereHasMorph() for MorphTo relationships.

so i changed WhereHas to WhereHasMorph but still showed error

Instantiation of 'Closure' is not allowed

what my expectation is to fetch records from user table where user_type='student' and check those student belongs to this class, this section in userprofile model and then check in studentuser model those students records are there or not for specific assessment_id

My user model

public function userprofile()
    {
        return $this->morphTo();
    }

    public function studentuser()
    {
        return $this->hasMany('App\StudentExamMain', 'student_id');
    }

My StudentRegistration model

 public function user()
    {
        return $this->morphOne('App\User', 'userprofile');
    }


any help please???

Activity icon

Replied to How To Generate Charts Using Barryvdh/laravel-dompdf And Make It Report

@bobbybouwmann thank you soo much for your response.

actually these much days i used barryvdh/laravel-dompdf only because just my client expected only tables so.

But now my client is a school. so they need charts, graphs, progress bar for student reports.

barryvdh/laravel-dompdf not supporting external css, javascript charts etc. so when i referred in google most of them said it is impossible to use barryvdh/laravel-dompdf for javascript charts,

so i planned to use barryvdh/laravel-snappy package.

in local pdf working fine. but as you said in live how i should do the change?? whether it is possible in shared hosting??

and one more thing i face error when working taking print out in images in barryvdh/laravel-snappy

the error is


The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files [===========================> ] 45% Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/font-for-print.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/question.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/progress-bar.css (ignore) [============================> ] 48% Error: Failed to load c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/, with network status code 202 and http status code 0 - Cannot open c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/: Path is a directory 

what may be the problem???

Activity icon

Replied to How To Use Barryvdh/laravel-snappy Package In Live Server Cpanel

@bobbybouwmann thank you soo much for your response.

actually these much days i used barryvdh/laravel-dompdf only because just my client expected only tables so.

But now my client is a school. so they need charts, graphs, progress bar for student reports.

barryvdh/laravel-dompdf not supporting external css, javascript charts etc. so when i referred in google most of them said it is impossible to use barryvdh/laravel-dompdf for javascript charts,

so i planned to use barryvdh/laravel-snappy package.

in local pdf working fine. but as you said in live how i should do the change?? whether it is possible in shared hosting??

and one more thing i face error when working taking print out in images in barryvdh/laravel-snappy

the error is


The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files [===========================> ] 45% Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/font-for-print.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/question.css (ignore) Warning: Failed to load file:///C:/Users/Azasoft/AppData/Local/Temp/css/progress-bar.css (ignore) [============================> ] 48% Error: Failed to load c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/, with network status code 202 and http status code 0 - Cannot open c:/xampp/htdocs/Laravel/OnlineExam-18-05-2020-staff/public/storage/: Path is a directory 

what may be the problem???

Jun
07
5 months ago
Activity icon

Replied to TinyMCE Editor Design Issue With Database And View Screen Laravel

@bobbybouwmann thank you so much for your response.

yes the answer which you gave for this question is what i needed. thank you..

yes i have lots of doubt in developing my application. but those are small doubts if some one intiate me, i will clear it.

sorry for mentioning the questions. if possible just visit the questions..

Activity icon

Replied to Multiple Foreign Key Indicating One Primary Key And Getting Values From Table

@tray2

my assessment table migration

            $table->bigIncrements('id');

            $table->bigInteger('login_user_id')->unsigned();
            $table->foreign('login_user_id')->references('id')->on('users')->onDelete('cascade');

            $table->string('assessment_name');
          
            $table->bigInteger('request_id')->unsigned();
            $table->foreign('request_id')->references('id')->on('request_assessments')->onDelete('cascade')-			 
            >nullable();

            $table->bigInteger('school_id')->unsigned();
            $table->foreign('school_id')->references('id')->on('school_registrations')->onDelete('cascade')->nullable();

            $table->bigInteger('class_id')->unsigned();
            $table->foreign('class_id')->references('id')->on('class_details')->onDelete('cascade')->nullable();

           
            $table->bigInteger('subject_id')->unsigned();
            $table->foreign('subject_id')->references('id')->on('subject_details')->onDelete('cascade')->nullable();


            $table->date('exam_date')->nullable();
            $table->double('timeduration')->nullable();         
            $table->string('assessment_status')->nullable();

in this subject_id is my question..

subject_id is foreign key. for this subject_id i need mutiple values?? how that is possible??

Activity icon

Replied to Multiple Foreign Key Indicating One Primary Key And Getting Values From Table

@tray2 thank you for you respose.

so i need to create a sub table for assessment and store the subject_id there if it has multiple value am i right??

ok i know to loop over it and will store it in table thats fine. ext how i can get the values from table for multiple values of foreign key

say for example

Where('subject_id', array of subject id's) how this can be achieved??