How your Laravel application can get hacked, and how to prevent that from happening by Antti Rössi
Category: Laravel
The Laravel team released Laravel 5.8.18 with HTML as a valid extension option for views. With this release, you can pass a path to an HTML file which will not…
JetBrains announced the release of PhpStorm 2019.1 this week with debugging support for Blade (and Twig) templates and a new predefined Laravel code style configuration. Upgrade your Laravel applications to Laravel…
This is a tutorial how to use pagination in Laravel. Inside PostsController:
1 2 3 4 5 6 |
public function index() { $posts = Post::paginate(10); return view('welcome', compact('posts')); } |
Inside blade:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
<!doctype html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <title>Laravel</title> <!-- Fonts --> <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet" type="text/css"> <!-- Styles --> <style> html, body { background-color: #fff; color: #636b6f; font-family: 'Nunito', sans-serif; font-weight: 200; height: 100vh; margin: 0; } .full-height { height: 100vh; } .flex-center { align-items: center; display: flex; justify-content: center; } .position-ref { position: relative; } .top-right { position: absolute; right: 10px; top: 18px; } .content { text-align: center; } .title { font-size: 50px; } .links > a { color: #636b6f; padding: 0 25px; font-size: 13px; font-weight: 600; letter-spacing: .1rem; text-decoration: none; text-transform: uppercase; } .m-b-md { /*margin-bottom: 0px;*/ } </style> </head> <body> <div class="container position-ref full-height"> <div class="content"> <div class="title m-b-md"> Pagination in Laravel </div> <div class="panel panel-default"> <div class="panel-heading"> <div> <h5>Posts {!! $posts->total() !!}</h5> </div> </div> <div class="panel-body"> @if(count($posts) > 0) <div class="table-responsive"> <table class="table table-bordered table-hover mb30 text-center"> <thead> <tr> <th class="text-center">ID</th> <th class="text-left">Title</th> <th class="text-left">Content</th> <th class="text-center">Image</th> <th class="text-center">Author</th> <th class="text-center">Created at:</th> </tr> </thead> <tbody> @foreach($posts as $post) <tr> <td>{!! $post->id !!} </td> <td class="text-left"> {!! $post->title !!}</td> <td class="text-left"> {!! $post->content !!}</td> <td class="text-left"> <img src="img/{{ $post->image }}" style="width: 30px; height: 30px;" /></td> <td class="text-left"> {!! $post->author_name !!}</td> <td class="text-left"> {!! $post->created_at!!}</td> </tr> @endforeach </tbody> </table> </div> {!! $posts->appends(Request::all())->render()!!} <div class="well"> <ul class="list-unstyled"> <li> <strong>Total posts: {!! $posts->total() !!}</strong> </li> <li> <strong>In this page: {!! $posts->count() !!}</strong> </li> <li> <strong>Total Pages: {!! $posts->lastPage() !!}</strong> </li> </ul> </div> @else <div class="well"> <h4>Posts list is empty</h4> </div> @endif </div> </div> </div> </div> </body> </html> |
If you are operative in the e-commerce circuit, then you must have known the importance of online transaction. As it is the most viable and fastest way to settle payments…
Get the project and don’t forget to rate on github. 🙂 https://github.com/EgHoxhaj/laravel-admin-dashboard
How to build Multiple Authentication in Laravel 5.7 using Middleware. This is a fresh Laravel installation. 1. Open .env file and set database credentials in these files. 2. Open the…
In today’s article, I am going to create a chatroom using Laravel, Pusher and VueJs. Since these tools are popular and almost every developer has heard of them, I will…
Today, we are share with you how to built real time CRUD system in laravel using google firebase. yes realtime insert, update, delete or listing is easily possible using google…
Taylor Otwell announced that in Laravel 5.7 the resources directory will be flattened instead of having an assets folder: View image on Twitter Taylor Otwell @taylorotwell Flattened the resources/assets directory into resources for…