Blogs – Hùng Bun – Phạm Việt Hùng

Tạo slug tự động bằng PHP/JavaScript

Tạo slug tự động bằng PHP code Nếu sử dụng code PHP thì thông thường giá trị của slug sẽ được tự động convert từ title của bài tin, như vậy ta sẽ cần một hàm để chuyển đổi đoạn…

Xem chi tiết

Simplest way to detect a mobile device (PHP)

Cách đơn giản nhất để bạn hiểu rõ hơn code của mình, như dưới đây nhé : $uaFull = strtolower($_SERVER['HTTP_USER_AGENT']); $uaStart = substr($uaFull, 0, 4); $uaPhone = [ '(android|bb\d+|meego).+mobile', 'avantgo', 'bada\/', 'blackberry', 'blazer', 'compal', 'elaine', 'fennec', 'hiptop', 'iemobile', 'ip(hone|od)', 'iris',…

Xem chi tiết

Ajax pagination with jQuery

Define Route Make Controller Make Model Make View 1.Define Route Route::get('posts', 'PostController@index'); Route::get('post-data', 'PostController@postData'); 2.Make Controller <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Post; class PostController extends Controller { function index() { return view('posts.index'); } function postData(Request $request) { if($request->ajax()) {…

Xem chi tiết

Laravel inline edit

Laravel inline edit with X-editable Define Route Make Model Make Controller Make View 1. Define Route Route::get('contacts','ContactController@index'); Route::post('contacts/update','ContactController@update'); 2. Make Model Table (contacts), 3 fileds: id, name, phone <?php namespace App; use Illuminate\Database\Eloquent\Model; class Contact extends Model { public $timestamps…

Xem chi tiết
Load more...