Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How do I output top readers from MySql table

//here we loaded students as well as we need to know the name
//and then group by `student_id`

$book_issues = book_issue::with('student')
->where('issue_date', 'LIKE', '%' . $request->month . '%')
->get()
->groupBy('student_id');

$row = 1;
@foreach($book_issues as $k => $v)
    <tr>
        <td>{{$row}}</td>
        <td>{{$v->first()->student->name}}</td>
        <td>{{$$v->count()}}</td>
    </tr>
    <?php 
        $row++;
    ?>
@endforeach
Comment

PREVIOUS NEXT
Code Example
Php :: how to use “find_in_set” in cakephp 3 find method 
Php :: php get first 5 letters of string 
Php :: laravel required_if fileld has value 
Php :: doctrine findby regex 
Php :: api newslater with php 
Php :: wordpress register_post_type capability gutenberg 
Php :: how can we manage category and product in laravek 
Php :: laravel length validation 
Php :: CURLAUTH_BEARER cannot find 
Php :: dont allow this command to every one set in meddlware laravel 
Php :: specific function to Unflatten array 
Php :: what is the mixmam size that php can take 
Php :: laravel-5-on-shared-hosting-wrong-public-path 
Php :: List all controllers in codeigniter HMVC structure 
Php :: how to decode json and combine again in php 
Php :: response in xml laravel 
Php :: gerar aquivo csv php 
Php :: php preg_match 
Php :: Expected response code 250 but got code "530", with message "530 Must issue a STARTTLS command first. " 
Php :: Route::auth(); giving error in laravel 7 
Php :: product slider shortcode woocommerce 
Php :: my xampp 
Php :: learn php basic 
Php :: authenticate user with phone laravel 
Php :: how to convert string to int in php laravel 
Java :: The import javax.persistence cannot be resolved 
Java :: jbutton set background transparent 
Java :: know the version of maven 
Java :: Java how to copy file 
Java :: How to solve the towers of Hanoi Java? 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =