vipin93

Self Coder at home

Experience

52,030

52 Best Reply Awards

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

17th May, 2017

vipin93 started a new conversation How To Use Merg Collection In View? • 1 week 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? • 1 week 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)? • 3 weeks 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)? • 3 weeks 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(); 

1st May, 2017

vipin93 started a new conversation Production.ERROR: InvalidArgumentException: Missing Required Client Configuration Options:? • 3 weeks ago

i try to use s3v on my production server on local its working fine but on server its keep throwing errors

[2017-05-01 22:04:45] production.ERROR: InvalidArgumentException: Missing required client configuration options:

 in /var/www/dbmszar/vendor/aws/aws-sdk-php/src/ClientResolver.php:364
Stack trace:
#0 /var/www/dbmszar/vendor/aws/aws-sdk-php/src/ClientResolver.php(260): Aws\ClientResolver->throwRequired(Array)
#1 /var/www/dbmszar/vendor/aws/aws-sdk-php/src/AwsClient.php(158): Aws\ClientResolver->resolve(Array, Object(Aws\HandlerList))
#2 /var/www/dbmszar/vendor/aws/aws-sdk-php/src/S3/S3Client.php(243): Aws\AwsClient->__construct(Array........
.....
....

vipin93 started a new conversation 404 Not Found • 3 weeks ago

i following http://devmarketer.io/learn/deploy-laravel-5-app-lemp-stack-ubuntu-nginx/ this tutorial but when i try to vigit another page of y app its throwing 404 erro r example.com working and when i visit example.com/login i got errors 404 here is my sites-enable/default

 root /var/www/dbmszar/public;
        index index.php index.html index.htm;

        server_name example.com;

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }
        location ~ \.php$ {
          include snippets/fastcgi-php.conf;
          fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }

        location ~ /\.ht {
            deny all;
        }

vipin93 left a reply on How To Blog/index.php Change To Point To /var/www/dbmszar/ ? • 3 weeks ago

nginx /ubuntu server

vipin93 started a new conversation How To Blog/index.php Change To Point To /var/www/laravel/ • 3 weeks ago

I have installed my laravel file in my server /var/www/laravel and my index.php file in /var/www/html/bae so how can i point to bootstrap autoload file in index.php i have done this

require __DIR__.'/../dbmszar/bootstrap/autoload.php';

$app = require_once __DIR__.'/../dbmszar/bootstrap/app.php';

my error.log file showing

PHP message: PHP Fatal error:  require(): Failed opening required '/var/www/html/bae/../dbmszar/bootst$.....

29th April, 2017

vipin93 left a reply on 500 Http Error - AJAX • 3 weeks ago

follow @Ruffles and 500 errors is your backend errors laravel

vipin93 left a reply on How To Integrate Dropbox In Filesystem? • 3 weeks ago

i solved by add "DropboxServiceProvider in my config/app'

now problem is that how can what image url should i store in my database so i can share show in database

vipin93 started a new conversation How To Integrate Dropbox In Filesystem? • 3 weeks ago

I have install "spatie/flysystem-dropbox" for dropbox as cloud storage for my image and i also register "DropboxServiceProvider" here is my serviceprovider

<?php

namespace App\Providers;

use Storage;
use League\Flysystem\Filesystem;
use Spatie\Dropbox\Client as DropboxClient;
use Illuminate\Support\ServiceProvider;
use Spatie\FlysystemDropbox\DropboxAdapter;

class DropboxServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        Storage::extend('dropbox', function ($app, $config) {
            $client = new DropboxClient(
                $config['authorizationToken']
            );

            return new Filesystem(new DropboxAdapter($client));
        });
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

and when i request file

$request->file('avatar')->store('avatars','dropbox');

i got errors

Driver [dropbox] is not supported.

thanks

26th April, 2017

vipin93 left a reply on Developing With Laravel Without Using Homestead • 4 weeks ago

switch to laragon.org if u windows user

vipin93 left a reply on 500 (Internal Server Error) On Post Request (Stripe) • 4 weeks ago

use chrome debug its laravel errors network->response

vipin93 left a reply on How Can We Upload Image Capture By Webcam? • 4 weeks ago

push

vipin93 started a new conversation How Can We Upload Image Capture By Webcam? • 4 weeks ago

I try to implement image capture feature user can upload image which taken by webcam the problem is now that i'm unable to upload image on my local server here is my javascript and view

(function(){
        var video = document.getElementById('video'),
         canvas = document.getElementById('canvas'),
         context = canvas.getContext('2d'),
         photo = document.getElementById('photo'),
         avatar = document.getElementById('avatar'),
         venderUrl = window.URL || window.webkitURL;

        navigator.getMedia = navigator.getUserMedia ||
                             navigator.webkitGetUserMedia ||
                             navigator.mozGetUserMedia ||
                             navigator.msGetUserMedia;

        navigator.getMedia ({
            video : true,
            audio : false
        },function(stream){
          video.src = venderUrl.createObjectURL(stream);
          video.play();
        },function(error){
            //
            //
        });  

        document.getElementById('capture').addEventListener('click',function(){
         context.drawImage(video,0,0,400,300);
         photo.setAttribute('src',canvas.toDataURL('image/png'));
         avatar.setAttribute('value',canvas.toDataURL('image/png'));
        });                 
    })();

and view

<form action="/staff/students/confirmation_request" method="post"  enctype="multipart/form-data">
                            {{ csrf_field() }
                          
                                         <video id="video"></video>
                                         <a href="#" id="capture" class="btn-primary btn ">Capture</a>

                                        <canvas id="canvas"></canvas>
                                        <img id="photo" src="https://placekitten.com/g/400/300" alt="your image">
                                       <input name="avatar" id="avatar" value="" class="form-control" type="file" />
                                    

                          <div class="form-group">
                              <button type="submit" class="btn btn-block btn-primary">Submit</button>
                          </div>
                      </form>

thanks

22nd April, 2017

vipin93 left a reply on Creating New Project • 1 month ago

because there is no vender folder may be u should run composer install and also u should move to laragon.org instead of xampp

vipin93 left a reply on Get A Property Of Related Model With Foreach • 1 month ago

users can have many image then u have defind in User model like this->hasmany('File::class', 'user_id' ); then u can call $user-images[filename]

20th April, 2017

vipin93 left a reply on Have You Built An App That Scaled To Support Huge Traffic? • 1 month ago

I'm slso building my app for my startup which is very big, i think in 1 year may be we had ve 40k register user we i'm also looking for good suggestion which hardware configuration should be we use and we have lots of relationships in our app

vipin93 left a reply on Current User In Middleware • 1 month ago

If(Auth::id() ==1) proceed esle redirect

vipin93 left a reply on Updating Address Table • 1 month ago

why u makin new Address for update method find the user address and update by request field

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

@topvillas ok sir now u saying so, I should follow your instruction

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

up

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

yes i have marked column 1 for present and 0 for absent

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

up

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

up

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

@martinbean yes your method is working fine I have did like this

$array=  array_map(function ($a, $b) { return round($a / $b * 100, 2); }, $array1, $array2); 

here another problem i was getting problem is that i getting the array in this format ['5','4'] now problem is that counting the value which groupby month when student absent in particular whole month it should be return null but its skip then value its must be in this format ['5',null,'4'] here is my controller

$month = StudentAttendence::selectRaw("month(date) as month")
        ->orderBy("id")
        ->groupBy(DB::raw('month(date)'))
        ->where('student_id',Auth::id())
        ->where('asession_id',$activesessionid->id)
        ->get();
        $present = StudentAttendence::selectRaw("count(id) as tot_present")
                                        ->orderBy("id")
                                        ->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")
                                        ->groupBy(DB::raw('month(date)'))
                                        ->where('student_id',Auth::id())
                                        ->where('asession_id',$activesessionid->id)                                       
                                       ->get();                                 
        foreach ($present as $key => $value) {               
                $presents[] = $value->tot_present; //here i was getting like ['1','1'] but i want it should be like ['1', null,'1'] because in march month there is no value count so it should return null but its ignored the value 
        } 
        foreach ($total as $key => $value) {               
                $totals[] = $value->tot_attendance;//and here ['1','1','1']
        }   

       $tota =  array_map(function ($a, $b) { return round($a / $b * 100, 2); }, $presents, $totals);    
        foreach ($month as $key => $value) {
            $date[] = Carbon::createFromDate(null,$value->month,null)->format('F');
        }                                                                   
        return view('student.attendence.attendences',compact('attendences'))
        ->with('date',json_encode($date))
        ->with('tota',json_encode($tota));

thanks

19th April, 2017

vipin93 left a reply on How Can Divide Two Array Value? • 1 month ago

up

vipin93 started a new conversation How Can Divide Two Array Value? • 1 month ago

i have two array value like

$array1 = ['50','60','97'];

$array2 = ['57','69','99'];

so how can do

$array = $array1/$array2 *100

output like

$array = ['87.71','86.95','97.97']

thanks

vipin93 left a reply on How Can I Print Month In "March Aprli..) Format? • 1 month ago

i did like

foreach ($month as $key => $value) {

            $date[] = Carbon::createFromDate(null,$value->month,null)->format('F');
        }

vipin93 started a new conversation How Can I Print Month In "March Aprli..) Format? • 1 month ago

I want to print month in my chartjs graph, but problem is that I'm getting value in integer format how can i print in english calendar format and use in my chart js here is my controller

$month = StudentAttendence::selectRaw("month(date) as month")
        ->orderBy("id")
        ->groupBy(DB::raw('month(date)'))
        ->get()->toArray();

and output is

array:1 [▼
  0 => array:1 [▼
    "month" => 4
  ]
]

thanks

18th April, 2017

vipin93 left a reply on Login Doesn't Work In Xampp • 1 month ago

move to laragon.org

vipin93 left a reply on How To Add Auth For A Resource Controller Method(s) • 1 month ago

use middlware in controller and specify which function u want

vipin93 left a reply on Get A Nested Relationship • 1 month ago

defind onetomany or onetoone as per your requirement and between events modatalies, modatalies modality_prices abd modality_prices enrollment then call as

$event=Event::with('modalities.modality_prices.enrollments)-first();

then use like $event->modatalies-> modality_prices-> enrollments[`username']

vipin93 left a reply on NPM / NODE Error • 1 month ago

this happened to with me, i just copy the webpack.config.js from laravrlmix to root folder

vipin93 left a reply on NotFoundHttpException In RouteCollection.php Line 161: • 1 month ago

simple things route not defind check by php artisan route:lits

17th April, 2017

vipin93 left a reply on How To Limit Value Within Foreach Loop? • 1 month ago

up

vipin93 left a reply on Laravel 5.4 Variable Problem Using Extends & Yield • 1 month ago

include will work

vipin93 left a reply on How To Limit Value Within Foreach Loop? • 1 month ago

up

vipin93 left a reply on How To Limit Value Within Foreach Loop? • 1 month ago

up

vipin93 left a reply on How To Limit Value Within Foreach Loop? • 1 month ago

@Baryla when i tried to group by its giving errors, i have selecteraw

vipin93 left a reply on How To Limit Value Within Foreach Loop? • 1 month ago

@jlrdw i tried but its not working

16th April, 2017

vipin93 started a new conversation How To Limit Value Within Foreach Loop? • 1 month ago

I try to make marksheet of students so there are four marks with subject id 1 so when i try to make print in foreach each loop its printing four times like

@foreach($exammarks as $exammark)

                          <tr>                 
                          <td rowspan="">{{$exammark->subjects['name'] }}</td>                  
                            <td rowspan="">{{$exammark->examnames['name'] }}</td>
                            <td>25</td>
                            <td>33</td>
                          </tr>
@endforeach 

my query

$exammarks = ExamMark::whereHas('courses',function($q) use($course, $cdate){
                          $q->where('id',$course)
                            ->where('created_at',$cdate);
                     })->orderBy('subject_id')
                     ->where('student_id',Auth::id())
                     ->with('courses','sections','examnames','subjects')
                     ->get();

here output https://www.dropbox.com/s/k4mb8u8h3kdxo5v/2.PNG?dl=0

now here subjects repeating two times but i want to limit only one

11th April, 2017

vipin93 started a new conversation How Can I Change Background Color On Change? • 1 month ago

how can i change background color on change in foreach loop , i tried but problem is that is only take first loop here is my view

  <?php $i = 0 ?>
                            @foreach($students as $student)
                            <?php $i++ ?>

                          <tbody class="text-center" id="backchange">

                                  <tr> 
                                    <td>{{ $i }}</td>
                            <td>{{ $student->studentacadmic->sections['name'] }}{{ $student->studentacadmic['roll_no'] }}</td>            
                                    <td>{{ $student['name'] }}</td>
                                     <td>{{ $student['reg_no'] }} </td>
                                     <td>
                                      <a href="/st/student/{{$student['reg_no'] }}" class="btn btn-primary btn-sm">
                                        <i class="fa fa-eye faa-pulse animated" aria-hidden="true"></i>
                                      </a>                                  
                                     </td>
                                     <td>
                                        <div class="form-group">
                                            <select class="form-control" name="marked[]" id="absent">
                                                <option value="1">Present</option>
                                                <option value="0">Absent</option>
                                            </select>
                                        </div>
                                     </td>                                   
                                  </tr>  
                             </tbody> 
                      @section('script')
                             <script type="text/javascript">
                             $('#absent').on('change',function(){
                            if( $(this).val()==="0"){
                            $("#backchange").css('background-color', 'blue');
                            }
                            else{
                            $("#backchange").css('background-color', '');
                            }
                        });
                           </script>
                           @endsection
                                                                                    
                             @endforeach      

8th April, 2017

vipin93 left a reply on How To Validate Unique Three Combination? • 1 month ago

up

7th April, 2017

vipin93 left a reply on How To Validate Unique Three Combination? • 1 month ago

up

vipin93 left a reply on Laravel Without Homestead • 1 month ago

for windows machine https://laragon.org/ is much bettor than other

vipin93 started a new conversation How To Validate Unique Three Combination? • 1 month ago

here I try to validate unique validation of three combination but did not

 'course' => 'required|unique:teacher_acadmics,course_id,NULL,asession_id,section_id, ' . $request['section'].$activesessionid->id,

but i was not successful in this

6th April, 2017

vipin93 left a reply on Validation Problem? • 1 month ago

@WebKenth i did different way i count the user active session if it's more than 0 then it will throw errors when user try to insert a session with true, he must first false the active session then he allow to insert with true

Edit Your Profile
Update

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