Basically there are there steps.
Step 1: Within your app/Libraries directory, create a Helpers.php file and add your functions.
Step 2: Within composer.json, in the autoload block, add "files": ["app/Libraries/helpers.php"].
Step 3: Run composer update.
Step 4: Showing the content.
Helpers.php
<?php
function notification_count()
{
$user_loggedin = Auth::user();
$id = $user_loggedin->id;
$sql = DB::table('notification')
->where('read_status', 0)
->where('user_id',$id)
->count('read_status');
echo $sql;
}
?>
composer.json
"files": [
"app/Libraries/Helpers.php"
],
Showing the content
<span class="badge" style="color:#FFFFFF !important;">{{ notification_count() }}</span> <i class="fa fa-caret-down"></i></a>
Step 1: Within your app/Libraries directory, create a Helpers.php file and add your functions.
Step 2: Within composer.json, in the autoload block, add "files": ["app/Libraries/helpers.php"].
Step 3: Run composer update.
Step 4: Showing the content.
Helpers.php
<?php
function notification_count()
{
$user_loggedin = Auth::user();
$id = $user_loggedin->id;
$sql = DB::table('notification')
->where('read_status', 0)
->where('user_id',$id)
->count('read_status');
echo $sql;
}
?>
composer.json
"files": [
"app/Libraries/Helpers.php"
],
Showing the content
<span class="badge" style="color:#FFFFFF !important;">{{ notification_count() }}</span> <i class="fa fa-caret-down"></i></a>
No comments:
Post a Comment