vipin93

Self Coder at home

Experience

55,310

56 Best Reply Awards

  • Member Since 2 Years Ago
  • 3 Lessons Completed
  • 0 Favorites

25th July, 2017

vipin93 left a reply on Is It Possible To Integrate Biomatric Attedence System In Laravel? • 1 day ago

@Snapey thanks i'll ask to provider

vipin93 left a reply on Is It Possible To Integrate Biomatric Attedence System In Laravel? • 1 day ago

can you give some idea are any blog post

vipin93 started a new conversation Is It Possible To Integrate Biomatric Attedence System In Laravel? • 1 day ago

Now in my app a auth user fill day, entry time, leave time mannully, but i want to make automatic with biomatric. so it is possible?

17th July, 2017

vipin93 left a reply on Serialization Of 'Closure' Is Not Allowed? • 1 week ago

@lars6 instead of job should i use event?

vipin93 started a new conversation Serialization Of 'Closure' Is Not Allowed? • 1 week ago

I tried to dispatch job for my app but its giving me errors

Serialization of 'Closure' is not allowed

here is my in controller

dispatch(new AuthSendMessage($students,$r,$user));

and my AuthSendMessage

class AuthSendMessage implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

     protected $students;
     protected $r;
     protected $user;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($students,$r,$user)
    {
       
        $this->students      = $students;
         $this->r                  = $r;
         $this->user            = $user;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        foreach ($this->students as $student)
         {       
            $data = [
         
             'student_id'       => $student->id ,
             'teacher_id'       => null,
             'by_owner_id'   => Auth::id(),
             'by_teacher_id' => null,
             'message'          => $this->r->message

            ];

                $numbers[] = $student->emer_no; 
          
                $this->user->messages()->create($data);
         }
    }

16th July, 2017

vipin93 left a reply on How Can I Combine Two Objects? • 1 week ago

I did like

$combine =  $timetables->merge($subjectnames);

and in view

@foreach($combine as $classe_section) {{ $i }} {{ $classe_section->courses['name'] }} {{ $classe_section->sections['name'] }}
                          @endforeach 
getting error 

Undefined index: name on line

{{ $classe_section->courses['name'] }} and when i try this {{ $classe_section->courses->name }}

Property [name] does not exist on this collection instance.

here is my $combine

[ { "id": 2, "user_id": 1, "name": "English", "remarks": null, "created_at": "2017-07-14 23:26:09", "updated_at": "2017-07-14 23:26:09" }, { "id": 3, "section_id": 1, "course_id": 2, "asession_id": 2, "user_id": 1, "start": "2017-07-16 07:40:00", "end": "2017-07-16 08:20:00", "created_at": "2017-07-16 00:38:54", "updated_at": "2017-07-16 00:38:54", "courses": { "id": 2, "user_id": 1, "name": "I", "remarks": null, "created_at": "2017-07-14 23:05:01", "updated_at": "2017-07-14 23:05:01" }, "sections": { "id": 1, "user_id": 1, "name": "A", "remarks": null, "created_at": "2017-07-14 23:25:51", "updated_at": "2017-07-14 23:25:51" } }, { "id": 1, "user_id": 1, "name": "Hindi", "remarks": null, "created_at": "2017-07-14 23:26:04", "updated_at": "2017-07-14 23:26:04" } ]


vipin93 started a new conversation How Can I Combine Two Objects? • 1 week ago

I try to show some value using foreach loop but problem is that i have two objects and when i try to use in foreach loop its run 4 times 2+2 but i want only 2 times how can i combine them here is my code

 <tbody class="text-center">
                                 <?php $i = 0 ?>
                                @foreach($timetables as $classe_section)
                                 @foreach($subjectnames as $subject)
                                <?php $i++ ?>
                                <tr>
                                    <td>{{ $i }}</td>
                                    <td>{{ $classe_section->courses['name'] }}</td>
                                    <td>{{ $classe_section->sections['name'] }}</td>
                                    <td>{{ $subject['name'] }}</td>
                                    <td>
                                      @foreach($testnames as $testname)
                                        <a class="btn btn-primary" href="/teacher/student/{{$classe_section->courses['id']}}/{{$classe_section->sections['id']}}/{{$subject['id']}}/{{$testname['id']}}/test_amrks_upload">{{ $testname['name'] }}
                                        </a>
                                      @endforeach
                                    </td>
                                </tr>
                                @endforeach
                                @endforeach
                            </tbody>

here i want merge $timetables and $subjectnames

vipin93 started a new conversation How To Avoid Duplicate Foreign Key For Different Colmn Name? • 1 week ago

I'm stuck with group by in my project , my problem is that i have table with 5 column name which stored foreign key value from one table now i want to group them by foreign key and if all column have same foreign key then show only one not all 5 time how can i do. here is my model and logic


      $timetables = TimeTable::where(function($q) use($userID,$activesessionidID){
                                      $q->where('user_id',$userID)
                                         ->where('asession_id',$activesessionidID);
                                   })->where(function($q){
                                      $q->orWhere('sunday_teacher_id',Auth::id())
                                         ->orWhere('monday_teacher_id',Auth::id())
                                         ->orWhere('tuesday_teacher_id',Auth::id())
                                         ->orWhere('wednesday_teacher_id',Auth::id())
                                         ->orWhere('thursday_teacher_id',Auth::id())
                                         ->orWhere('friday_teacher_id',Auth::id())
                                         ->orWhere('saturday_teacher_id',Auth::id());
                                   })->groupBy(['sunday_subject_id','monday_subject_id','tuesday_subject_id','wednesday_subject_id','thursday_subject_id','friday_subject_id','saturday_subject_id'])->get();

my time table model

   <?php

namespace App\Model\Staff\Acadmic;

use Illuminate\Database\Eloquent\Model;
use App\Model\Staff\Acadmic\TimeTable;
use Carbon\Carbon;
use App\Model\Day;
use App\Subject;
use App\Teacher;
use App\User;
use App\Course;
use App\Section;
use App\Asession;

class TimeTable extends Model
{
 
  
    protected $fillable = [
       'start','end','asession_id','section_id','course_id','sunday_subject_id','sunday_teacher_id','monday_subject_id','monday_teacher_id','tuesday_subject_id','tuesday_teacher_id','wednesday_subject_id','wednesday_teacher_id','thursday_subject_id','thursday_teacher_id','friday_subject_id','friday_teacher_id','saturday_subject_id','saturday_teacher_id','sunday_remarks', 'monday_remarks' ,'tuesday_remarks','wednesday_remarks' ,'thursday_remarks' ,'friday_remarks', 'saturday_remarks'
    ];
     //'break_start','break_end',
     protected $dates = ['start','end'];


     public function setStartAttribute($value)
    {
        
        $this->attributes['start'] = Carbon::createFromFormat('g:i A',$value);
    }

    public function setEndAttribute($value)
    {
         
        $this->attributes['end'] = Carbon::createFromFormat('g:i A',$value);
    }

    public function sundaysubjects()
    {
        return $this->belongsTo(Subject::class,'sunday_subject_id');
    }

    public function sundayteachers()
    {
        return $this->belongsTo(Teacher::class,'sunday_teacher_id');
    }

    public function mondaysubjects()
    {
        return $this->belongsTo(Subject::class,'monday_subject_id');
    }

    public function mondayteachers()
    {
        return $this->belongsTo(Teacher::class,'monday_teacher_id');
    }

    public function tuesdaysubjects()
    {
        return $this->belongsTo(Subject::class,'tuesday_subject_id');
    }

    public function tuesdayteachers()
    {
        return $this->belongsTo(Teacher::class,'tuesday_teacher_id');
    }

    public function wednesdaysubjects()
    {
        return $this->belongsTo(Subject::class,'wednesday_subject_id');
    }

    public function wednesdayteachers()
    {
        return $this->belongsTo(Teacher::class,'wednesday_teacher_id');
    }

    public function thursdaysubjects()
    {
        return $this->belongsTo(Subject::class,'thursday_subject_id');
    }

    public function thursdayteachers()
    {
        return $this->belongsTo(Teacher::class,'thursday_teacher_id');
    }

    public function fridaysubjects()
    {
        return $this->belongsTo(Subject::class,'friday_subject_id');
    }

    public function fridayteachers()
    {
        return $this->belongsTo(Teacher::class,'friday_teacher_id');
    }

    public function saturdaysubjects()
    {
        return $this->belongsTo(Subject::class,'saturday_subject_id');
    }

    public function saturdayteachers()
    {
        return $this->belongsTo(Teacher::class,'saturday_teacher_id');
    }



    public function sections()
    {
        return $this->belongsTo(Section::class,'section_id');
    }

    public function courses()
    {
        return $this->belongsTo(Course::class,'course_id');
    }

    public function asessions()
    {
        return $this->belongsTo(Asession::class,'asession_id');
    }

     public function users()
    {
        return $this->belongsTo(User::class,'user_id');
    }
}

5th July, 2017

vipin93 started a new conversation How Can I Generate Unique And Random Combination? • 3 weeks ago

I'm try to generate time table of school which should random and unique combination of some value like I have value in database combination of teacher, class, section,subject now i want time table will generate combination of

day time teacher subject

for particular class and section

please give some guide, I'have no clue thanks

3rd July, 2017

vipin93 started a new conversation CURL Error 7: Failed To Connect To Api.mailgun.net • 3 weeks ago

I'm try to use Bogardo/Mailgun to use for my newsletter email sending but when I try to send simple email its throwing error

cURL error 7: Failed to connect to api.mailgun.net port 80: Timed out (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

23rd June, 2017

vipin93 started a new conversation Dropdown Not Working? • 1 month ago

I'm using datatables for my database record but when i'm added js file of datatables my menu dropdown not working when i removed my dropdown file my dropdown working .

like my main layout file

<script src="/js/app.js"></script> 
      @yield('script')
  </body>

and my page where i'm using script

@section('script')
<script type="text/javascript" src="{{asset('/js/datatables.min.js')}}" ></script>
<script src="{{asset('/vendor/datatables/buttons.server-side.js')}}"></script>
.....
...
@stop 

here when i removed

<script type="text/javascript" src="{{asset('/js/datatables.min.js')}}" ></script>
<script src="{{asset('/vendor/datatables/buttons.server-side.js')}}"></script>

my dropdown working thanks

19th June, 2017

vipin93 left a reply on How To Order By In Eloquent Relationships? • 1 month ago

use eager load with where clause

14th June, 2017

vipin93 started a new conversation How Can I Combine This Query? • 1 month ago

 $hostel_fee = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('hostel_fee'); 
 $hostel_fee_late = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('late_fee');

$hostel_fee_other = HostelFeeCollection::whereHas('asessions',function($q) use($activesession){
                                      $q->where('user_id',Auth::id())
                                      ->where('id',$activesession->id);
                                    })->sum('other_fee');

10th June, 2017

vipin93 left a reply on Why I'm Not Getting Expected Value? • 1 month ago

@mushood problem solved its about order first AND Then OR

@Snapey

Can you see the mysql log?

I did not get this

vipin93 started a new conversation Why I'm Not Getting Expected Value? • 1 month ago

I try to fetch users who have subscription created month is equal to current last month but its giving all users here is my function (I have to user only id 1, and 2


        //$lastmonth = Carbon::now()->subMonth(1)->month; 

        $users = User::where('active',1)->where('plan','!=',0)->orWhere('plan',1)
                        ->orWhere('plan',2)->whereHas('subscriptions',function($q){
                            $q->whereMonth('created_at',5');
                        })->select('id')->get();
       return $users;

and output

[
{
"id": 1
},
{
"id": 2
}
]

and here is my subscriptions table ( https://ibb.co/jKFGtF)

vipin93 left a reply on How To Show Data Of Other Table For Current Auth User..? • 1 month ago

if ur problem solved then marked best answer so that it help to other

vipin93 left a reply on Help Me With Working Flow For My Dedicated Server. • 1 month ago

use git work flow

8th June, 2017

vipin93 left a reply on It Is Ok To Use LetsEncrypt Free SSL? • 1 month ago

I comparing Ssl price from different different website and i see what, its very price different some website. for combo some webs

vipin93 left a reply on It Is Ok To Use LetsEncrypt Free SSL? • 1 month ago

yaa i think so its all about warranty but, if i using free ssl it's common perception in user mind that we are not concerned about security because we not spend some $$ on certificate in simple word if something is free then that's not good

vipin93 left a reply on It Is Ok To Use LetsEncrypt Free SSL? • 1 month ago

@Snapey yes i don't have wildcard url and I'm also using certbot maintain my certificate

vipin93 left a reply on It Is Ok To Use LetsEncrypt Free SSL? • 1 month ago

@bashy no i don't take payment via my server, just they will login and and see stuff

vipin93 started a new conversation It Is Ok To Use LetsEncrypt Free SSL? • 1 month ago

I have made web app for my startup a SaaS aap, and I'm using free letsencrypt (due to money problem). so it's ok if I'm using free ssl? i'll switch to paid if i got a customer. so my question is its safe to use free SSL? thanks

7th June, 2017

vipin93 left a reply on Get Name Of Foreign Key • 1 month ago

@shakti bhai kya ulte sidhe answer likha hai yaar iska sidha saa answer hoga @shoulieheinds your questions answered is like

Your User Model look like

   public function religions()
    {
      return $this->belongsTo(Religion::Class,'religion_id');
    }

and in your controller use lazy loading like

$user = Auth::user();
$user->load('religions');

and in your view use like

$user->religions['name'];

vipin93 left a reply on How To Show Data Of Other Table For Current Auth User..? • 1 month ago

Your relationship should looks like your User model

public function researchs(){

return $this->hasMany(Research::class);
}

your Research model

public function users(){

return $this->hasMany(User::class);
}

then u can call

$user = Auth::user();
$user->load('researchs')

vipin93 left a reply on Update User Profile • 1 month ago

vipin93 left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 1 month ago

i think it's not good idea to use hidden field , why making your app complex and extra code if laravel already provide nice stuff with less code

vipin93 left a reply on HOW TO CRREATE A PROFILE UPDATE CODING ? IN LARAVEL PLS HELP • 1 month ago

dude thats very basic stuff, did u watched laracasts laravel 5.** any series

vipin93 left a reply on HOW TO CRREATE A PROFILE UPDATE CODING ? IN LARAVEL PLS HELP • 1 month ago

its seems like u have to follow laracasts laravel 5.4 series, no one will write code for u

vipin93 left a reply on Whoops, Looks Like Something Went Wrong. 1/1 FatalErrorException In ProfileController.php Line 117: Syntax Error, Unexpected 'public' (T_PUBLIC) In ProfileController.php Line 117 • 1 month ago

@tisuchi i think using hidden user id is not safe what if someone changed id just using chrome dev tool and not appropriate way to save instead he can use relationship in this case he just pass

Auth->user()->save($data) 

or

$user = Auth::user();  
$user->stuff = $request->stuff
...
..
..
$user->save()

6th June, 2017

vipin93 left a reply on How Can Deploy Two App Demo.example.com And Example.com? • 1 month ago

@tekmi that's not i want and my problem is solved i pointing my url instead i should point @

5th June, 2017

vipin93 left a reply on How Can Deploy Two App Demo.example.com And Example.com? • 1 month ago

i have checked its fine server_name demo.example.com

vipin93 started a new conversation How Can Deploy Two App Demo.example.com And Example.com? • 1 month ago

i tried t deploy my main app and my demo app on same LEMP server i have created two block one example.com and for demo.example.com but everytime when i tried to go demo.example.com its throw an errors "Server not found" and i checked my access log file and error log nothing find i'm using LEMP server and and my domain provider godaddy

4th June, 2017

vipin93 left a reply on Uploading File / Photo. • 1 month ago

why u confused in simple word u will upload your photo name along with other stuff

3rd June, 2017

vipin93 left a reply on Can Someone Explain How Can I Deploy More Than Two App LEMP Server? • 1 month ago

@fideloper

you may also have a bad Nginx configuration

what is the best Nginx configuration for multiple app , any reference thanks

2nd June, 2017

vipin93 left a reply on Can Someone Explain How Can I Deploy More Than Two App LEMP Server? • 1 month ago

i restart my server and everything looks fine but when i try to visit demo.mysite.com its not showing page and errors "demo.mysite.com server dns address could not be found DNS_PROBE_FINSIHED_NXDOMAIN"

vipin93 left a reply on Can Someone Explain How Can I Deploy More Than Two App LEMP Server? • 1 month ago

no i'm using for my startup and now i don't have any customer so i thought first go for 5$ plan and after if i got customer then i'll migrate for bigger plan(money problem), i have question is that its fine to deploy two app one for demo and one main app? thanks

vipin93 left a reply on Hosting Laravel App • 1 month ago

vipin93 started a new conversation Can Someone Explain How Can I Deploy More Than Two App LEMP Server? • 1 month ago

I tried to deploy two app one main app and other is demo app now i successfully deploy and made server block site enable "demo_dms" but problem when i restart my nginx server its giving errors

nginx: [alert] mmap(MAP_ANON|MAP_SHARED, 134217728) failed (12: Cannot allocate memory)
nginx: configuration file /etc/nginx/nginx.conf test failed 

I'm using amazon lightsail 5$ plan thanks

29th May, 2017

vipin93 left a reply on Anybody Know Reason Behind The Route Ordering, • 1 month ago

nope here what i got "web,revalidate,auth:student,active" this is all middleware in auth.php its not repeating

28th May, 2017

vipin93 left a reply on Anybody Know Reason Behind The Route Ordering, • 1 month ago

5.4

vipin93 left a reply on Anybody Know Reason Behind The Route Ordering, • 1 month ago

yes i know, but it should not i just change route order and its working fine , i just made three different route file for different module


    protected function mapTeacherRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/teacher.php'));
    }

    protected function mapPageRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/page.php'));
    }

     protected function mapStudentRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/student.php'));
    }

    protected function mapAuthRoutes()
    {
        Route::middleware('web')
             ->namespace($this->namespace)
             ->group(base_path('routes/auth.php'));
    }

here i change order of mapAuthRoutes and mapAuthRoutes its working

vipin93 started a new conversation Anybody Know Reason Behind The Route Ordering, • 1 month ago

Anybody know reason behind the route ordering, like i have route get('login..') get('som1',....) and get('som2',....) when i click on /some2 its redirecting to /login but when i changed the order of route get('som2',....) then get('som1',....) everything fine. if anybody have solution please share because its difficult for large project more than 150 route

17th May, 2017

vipin93 started a new conversation How To Use Merg Collection In View? • 2 months ago

I tried to merge to collection from different table, but when i tried to use in view its giving error

Property [max_mark] does not exist on this collection instance.

here is my controller

$exammarks = ExamMark::where('student_id',Auth::id())->orderBy('subject_id')->with('examnames','subjects')->get();
            $testmarks = TestMark::where('student_id',Auth::id())->orderBy('subject_id')->with('testnames','subjects')->get(); 

             $exammarks1 = collect([$exammarks]); 
             $testmarks1 = collect([$testmarks]); 
             $allItems = $exammarks1->merge($testmarks1);
             //return $allItems;  

              $allItems->each(function($allItem)
              {
                  echo $allItem->max_mark.'<br />';
              });

and my collection

0   
0   
id  1
asession_id 1
taker_id    1
exam_id 1
course_id   1
section_id  1
student_id  1
subject_id  1
max_mark    50
score_mark  33
date    "2017-05-01 00:00:00"
created_at  "2017-05-17 22:05:24"
updated_at  "2017-05-17 22:05:24"
examnames   
id  1
user_id 1
name    "Mid Term"
max_mark    50
created_at  "2017-05-11 10:27:31"
updated_at  "2017-05-11 10:27:31"
subjects    
id  1
user_id 1
name    "Hindi"
created_at  "2017-05-17 21:58:03"
updated_at  "2017-05-17 21:58:03"
1   
id  4
asession_id 1
taker_id    1
exam_id 1
course_id   1
section_id  1
student_id  1
subject_id  3
max_mark    50
score_mark  12
date    "2017-05-02 00:00:00"
created_at  "2017-05-17 22:09:26"
updated_at  "2017-05-17 22:09:26"
examnames   
id  1
user_id 1
name    "Mid Term"
max_mark    50
created_at  "2017-05-11 10:27:31"
updated_at  "2017-05-11 10:27:31"
subjects    
id  3
user_id 1
name    "Math"
created_at  "2017-05-17 21:58:23"
updated_at  "2017-05-17 21:58:23"
1   
0   
id  1
asession_id 1
taker_id    3
test_id 1
course_id   1
section_id  1
student_id  1
subject_id  1
max_mark    25
score_mark  11
date    "2017-05-11 00:00:00"
created_at  "2017-05-17 22:07:39"
updated_at  "2017-05-17 22:07:55"
testnames   
id  1
user_id 1
name    "Test no. 1"
max_mark    25
created_at  "2017-05-11 10:27:11"
updated_at  "2017-05-11 10:27:11"
subjects    
id  1
user_id 1
name    "Hindi"
created_at  "2017-05-17 21:58:03"
updated_at  "2017-05-17 21:58:03"

14th May, 2017

vipin93 started a new conversation On Local(windows) Working Fine But On Server(ubuntu 16.04) Errors? • 2 months ago

i just install this package its working fine on my local server but when i deploy my code its giving me errors " production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App\Datatables\DataTableBase' not found in" i dont know why i double checked namespace is fine i deploy my code via git local to production(ssh) thanks

3rd May, 2017

vipin93 left a reply on Why This Code Not Working On Vps Server(ubuntu)? • 2 months ago

on my server i have mysql and on local i have mariaDB(mysql) i tried this https://mattstauffer.co/blog/strict-mode-and-other-mysql-customizations-in-laravel-5-2 but its not solve my problem

vipin93 started a new conversation Why This Code Not Working On Vps Server(ubunut)? • 2 months ago

i try to count some value groupBy but it working locally fine but on my vps cloud server its not working its throwing these this errors

1055 Expression #1 of ORDER BY clause is not in GROUP BYclause and contains nonaggregated column 'dbmszar.student_attendences.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible

my query is here

$month = StudentAttendence::selectRaw("month(date) as month")
                                    ->orderBy('id','asc')
                                    ->groupBy(DB::raw('month(date)'))
                                    ->where('student_id',Auth::id())
                                    ->where('asession_id',$activesessionid->id)
                                    ->get();

$present = StudentAttendence::select(DB::raw("count(id) as tot_present,month(date) as month"))
                                        ->orderBy('id','asc')
                                        ->groupBy(DB::raw('month(date)'))
                                        ->where('student_id',Auth::id())
                                        ->where('asession_id',$activesessionid->id)
                                        ->where('marked',1)
                                        ->get();
$total = StudentAttendence::selectRaw("count(id) as tot_attendance")
                                        ->orderBy('id','asc')
                                        ->groupBy(DB::raw('month(date)'))
                                        ->where('student_id',Auth::id())
                                        ->where('asession_id',$activesessionid->id)
                                        ->get(); 
Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.