Category: PHP

0

Tutorial Laravel from Scratch

Haloo php developer Sebelumnya penulis pernah mempublikasikan tutorial PHP Native dengan PDO, kali ini penulis akan membagikan ebook Tutorial Laravel 5.0 menggunakan Env Apache2 Linux14.04LTS dan PHP5 serta MySQL5.5 tentunya dengan judul Laravel from...

0

Laravel Dynamic Menu

 <ul class=”sidebar-menu”> <li class=”header”>NAVIGATION</li> <?php $menu_0 = \App\Menu::where(‘id_induk’,0)->get(); foreach ($menu_0 as $key) { get_menu_child($key->id); } function get_menu_child($parent=0){ $menu = \App\Menu::where(‘id_induk’,$parent)->get(); $parent = \App\Menu::where(‘id’,$parent)->first(); ?> <li class=”treeview”> <a href=”{{url($parent->url)}}”> <i class=”fa {{$parent->icon}}”></i> <span>{{$parent->nama}}</span> @if(sizeof($menu)>0) <i...

0

Laravel Named Routes

Route::get(‘master/division/all’, [‘as’=>’all_division’,’uses’=>’MasterController@division_index’]); Route::get(‘master/division/add’, [‘as’=>’add_division’,’uses’=>’MasterController@division_add’]); Route::post(‘master/division/save’, [‘as’=>’save_division’,’uses’=>’MasterController@division_save’]); Route::get(‘master/division/edit/{id}’, [‘as’=>’edit_division’,’uses’=>’MasterController@division_edit’]); Route::post(‘master/division/update’, [‘as’=>’update_division’,’uses’=>’MasterController@division_update’]); Route::get(‘master/division/delete/{id}’, [‘as’=>’delete_division’,’uses’=>’MasterController@division_delete’]); Route::get(‘master/level/all’, [‘as’=>’all_level’,’uses’=>’MasterController@level_index’]); Route::get(‘master/level/add’, [‘as’=>’add_level’,’uses’=>’MasterController@level_add’]); Route::post(‘master/level/save’, [‘as’=>’save_level’,’uses’=>’MasterController@level_save’]); Route::get(‘master/level/edit/{id}’, [‘as’=>’edit_level’,’uses’=>’MasterController@level_edit’]); Route::post(‘master/level/update’, [‘as’=>’update_level’,’uses’=>’MasterController@level_update’]); Route::get(‘master/level/delete/{id}’, [‘as’=>’delete_level’,’uses’=>’MasterController@level_delete’]); Route::get(‘master/employeer/all’, [‘as’=>’all_employeer’,’uses’=>’MasterController@employeer_index’]); Route::get(‘master/employeer/add’, [‘as’=>’add_employeer’,’uses’=>’MasterController@employeer_add’]); Route::post(‘master/employeer/save’, [‘as’=>’save_employeer’,’uses’=>’MasterController@employeer_save’]); Route::get(‘master/employeer/edit/{id}’, [‘as’=>’edit_employeer’,’uses’=>’MasterController@employeer_edit’]); Route::post(‘master/employeer/update’, [‘as’=>’update_employeer’,’uses’=>’MasterController@employeer_update’]);...

0

PHP Header untuk Export Excel

<?php header(‘Content-type: application/vnd.ms-excel’); header(‘Content-Disposition: attachment; filename=filename.xls’); ?> <table> <thead> <th></th> </thead> <tbody> <tr> <td></td> </tr> </tbody> </table>

0

PHP Laravel save data dengan upload file

$gambar = “”; $divisi = new Divisi; $divisi->nama = Input::get(‘nama’); if(Input::hasFile(‘gambar’) and Input::file(‘gambar’)->isValid()){ $gambar = date(“YmdHis”) .uniqid() .”.” .Input::file(‘gambar’)->getClientOriginalExtension(); Input::file(‘gambar’)->move(storage_path().’/gambardivisi’,$gambar); } $divisi->gambar = $gambar; $divisi->keterangan = Input::get(‘keterangan’); $divisi->save();

0

PHP Laravel update data dengan upload file

$gambar = “”; $divisi = Divisi::where(‘id’,Input::get(‘id’))->first(); $divisi->nama = Input::get(‘nama’); if(Input::hasFile(‘gambar’) and Input::file(‘gambar’)->isValid()){ $gambar = date(“YmdHis”) .uniqid() .”.” .Input::file(‘gambar’)->getClientOriginalExtension(); Input::file(‘gambar’)->move(storage_path().’/gambardivisi’,$gambar); $divisi->gambar = $gambar; } $divisi->keterangan = Input::get(‘keterangan’); $divisi->save();

0

PHP Function text slicer

public function slicer($value, $len=15) { if(strlen($value)>$len){ $value = substr($value, 0, $len).”…”; } return $value; }