Last active
September 19, 2017 14:54
-
-
Save mostafa6765/be5c067852b5cb4102e45c2622f4ce89 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach ($users as $key => $me) | |
@if ( Date::parse($me->created_at)->format('l j F Y ')==Date::parse('now')->format('l j F Y ') ) | |
<p>{{ Date::parse($me->created_at)->ago() }}</p> | |
@else | |
<p>{{ Date::parse($me->created_at)->format('l j F Y H:i:s') }}</p> | |
@endif | |
@endforeach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? php | |
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\User; | |
use Jenssegers\Date\Date; | |
class DateController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
Date::setLocale('en'); | |
$users = User::paginate(10); | |
return view('paginate')->withUsers($users); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@foreach ($users as $key => $me) | |
@if ($me->created_at->diffForHumans()<=12) | |
<p>{{ Date::parse($me->created_at)->ago() }}</p> | |
@else | |
<p>{{ Date::parse($me->created_at)->format('l j F Y H:i:s') }}</p> | |
@endif | |
@endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment