Framework

Create user permission by URI in Codeigniter 3

Hello. No I want to share how to about to create user role/permission by access URI. Oke now the first you must download new CodeIgniter 3 in this site https://www.codeigniter.com/download.
After that we must open CodeIgniter framework on your editor. Example I use sublime text.
Oke lest go code, the first we must change config/autoload.php and add auto load library ‘session’ and helper ‘url’.

/*
| -------------------------------------------------------------------
|  Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
|	$autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
|	$autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session');

/*
| -------------------------------------------------------------------
|  Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
|	$autoload['drivers'] = array('cache');
*/
$autoload['drivers'] = array();

/*
| -------------------------------------------------------------------
|  Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
|	$autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url');

Then change config/database.php with your database config.
(more…)

Advertisements

Install Twig (views template) in Slim Framework

Okay from latest post, I created a tutorial about how to use slim framework/first install slim framework. And now I want to share how to install twig for views template in slim. But how to do it?
Okay frist open your slim framework again, and open file composer.json and change to be like this:

{
    "require": {
        "slim/slim": "~2.6",
        "slim/views": "~0.1",
        "twig/twig": "~1.0"
    }
}

Explanations:

  1. Line 4 is the package to install twig/smarty in slimframework, more info read this https://github.com/slimphp/Slim-Views
  2. Line 5 is to install core twig

(more…)

Install and trying Slimframework

Hi and hallo. Long time I not write article again and now I back again with new article. Previously I using and learning laravel, and now Laravel has reached version 5. For now why I choose slim and not laravel again?

Because I want to use framework with small size and simple. Laravel is big framework (framework full stack). Laravel has many functions and features, but all unused by me and the features it becomes useless if not used.

So now I want share how to install and trying slimframework. The first, you must install composer. Follow this link https://getcomposer.org/download/. After you success intall composer, now open slimframework site and follow installation guide from there. Or you can open cmd if you’re using windows and open terminal if you using Linux/unix and follow this instruction:
(more…)

Create role and permission (Using Entrust) in Laravel

Long time not write blog again, and now I want share how to add permission user using entrust. Okay for the installation, follow the steps below:
First open your laravel project and add this code to your composer:

"require": {
		"laravel/framework": "4.*",
		"barryvdh/laravel-debugbar": "dev-master",
		"zizaco/entrust": "dev-master"
	},

After that, run composer update:

$ composer update

If update succesfully, now open your app.php from your laravel config:
(more…)

Laravel 4 create PDF (use dompdf)

After not updating this blog for a few days, now I want to share how to create PDF in laravel using dompdf package from https://github.com/barryvdh/laravel-dompdf. Ok for installation follow this steps:
First we must add the barryvdh/laravel-dompdf to the composer with command:

aim@linux-yr22:~$ composer require barryvdh/laravel-dompdf:* --no-update
aim@linux-yr22:~$ composer update

Then we must add service provider to app/config/app.php:

	'providers' => array(

		'Illuminate\Foundation\Providers\ArtisanServiceProvider',
		'Illuminate\Auth\AuthServiceProvider',
		'Illuminate\Cache\CacheServiceProvider',
		'Illuminate\Session\CommandsServiceProvider',
		'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
		'Illuminate\Routing\ControllerServiceProvider',
		'Illuminate\Cookie\CookieServiceProvider',
		'Illuminate\Database\DatabaseServiceProvider',
		'Illuminate\Encryption\EncryptionServiceProvider',
		'Illuminate\Filesystem\FilesystemServiceProvider',
		'Illuminate\Hashing\HashServiceProvider',
		'Illuminate\Html\HtmlServiceProvider',
		'Illuminate\Log\LogServiceProvider',
		'Illuminate\Mail\MailServiceProvider',
		'Illuminate\Database\MigrationServiceProvider',
		'Illuminate\Pagination\PaginationServiceProvider',
		'Illuminate\Queue\QueueServiceProvider',
		'Illuminate\Redis\RedisServiceProvider',
		'Illuminate\Remote\RemoteServiceProvider',
		'Illuminate\Auth\Reminders\ReminderServiceProvider',
		'Illuminate\Database\SeedServiceProvider',
		'Illuminate\Session\SessionServiceProvider',
		'Illuminate\Translation\TranslationServiceProvider',
		'Illuminate\Validation\ValidationServiceProvider',
		'Illuminate\View\ViewServiceProvider',
		'Illuminate\Workbench\WorkbenchServiceProvider',
		'Barryvdh\Debugbar\ServiceProvider',
		'Barryvdh\DomPDF\ServiceProvider',
	),

Then add Facade for shorter code. What facade? I will explain later in below paragraph.
(more…)

Create One Blade Template (Layout) for All page in Laravel 4

Okay for long time, I will update the blog content and now I want to share how to create one base template or one layout for all page in my laravel framework. The structure might look like this:

And now the first we must change the head.blade.php like this (I using bootstrap):

<title>Simple Project</title>
<meta charset="utf-8">
<meta name="description" content="Simpel Project">
<meta name="Imron Rosdiana" content="Simple Project">

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap-theme.min.css">

<!-- Jquery -->
<script src="//code.jquery.com/jquery-2.1.1.min.js" type="text/javascript"></script>

Explanations:
(more…)

Adding Laravel Debugbar like Symfony2 debugbar.

Hello I’am back again for long time.. :D, sory for long time and wait your time to see my new post. I’am sory, now I’ve some problem with my homework and now I’m working on my thesis. I hope you understand this. I’am is only one administrator on this blog and I was a student in one of the colleges, so I’ve many homeworks 🙂 So if you want to help me and join in with being the author of this blog, then please email me at imron_tux@yahoo.com.
Okay back to the topic, we now Symfony2 from default have profiler or panel debugbar on the bottom page if we run on development site like this:
.
And now laravel have plugin similiar symfony2, I got it from here https://github.com/barryvdh/laravel-debugbar. And this how to install the debugbar on Laravel:
The first open your composer.json on your laravel, example composer.json me:
(more…)