Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/recca0120/laraigniter
Codeigniter with Eloquent and Blade
https://github.com/recca0120/laraigniter
Last synced: 24 days ago
JSON representation
Codeigniter with Eloquent and Blade
- Host: GitHub
- URL: https://github.com/recca0120/laraigniter
- Owner: recca0120
- License: mit
- Created: 2016-07-23T13:50:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-08T10:58:24.000Z (about 8 years ago)
- Last Synced: 2024-10-09T11:24:59.567Z (about 1 month ago)
- Language: HTML
- Homepage:
- Size: 3.64 MB
- Stars: 18
- Watchers: 6
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: contributing.md
- License: license.txt
Awesome Lists containing this project
README
# Codeigniter with Eloquent and Blade
[![Latest Stable Version](https://poser.pugx.org/recca0120/laraigniter/v/stable)](https://packagist.org/packages/recca0120/laraigniter)
[![Total Downloads](https://poser.pugx.org/recca0120/laraigniter/downloads)](https://packagist.org/packages/recca0120/laraigniter)
[![Latest Unstable Version](https://poser.pugx.org/recca0120/laraigniter/v/unstable)](https://packagist.org/packages/recca0120/laraigniter)
[![License](https://poser.pugx.org/recca0120/laraigniter/license)](https://packagist.org/packages/recca0120/laraigniter)
[![Monthly Downloads](https://poser.pugx.org/recca0120/laraigniter/d/monthly)](https://packagist.org/packages/recca0120/laraigniter)
[![Daily Downloads](https://poser.pugx.org/recca0120/laraigniter/d/daily)](https://packagist.org/packages/recca0120/laraigniter)## Installation
Add Presenter to your composer.json file:
```json
"require": {
"recca0120/laraigniter": "^0.1"
}
```
Now, run a composer update on the command line from the root of your project:```
composer update
```## How to use
import user.sql to mysql
### Database Config
application/config/database.php
```php
$db['default']['hostname'] = 'your hostname';
$db['default']['username'] = 'your username';
$db['default']['password'] = 'your password';
$db['default']['database'] = 'your test';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = true;
$db['default']['db_debug'] = true;
$db['default']['cache_on'] = false;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = true;
$db['default']['stricton'] = false;
```### Model
application/models/User.php
```php
namespace App\Models;use Illuminate\Database\Eloquent\Model;
class User extends Model
{
protected $fillable = [
'name',
'email',
'password',
];
}
```### Controller
application/controllers/welcome.php
```php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}use App\Models\User;
class Welcome extends CI_Controller
{
public function index()
{
User::create([
'name' => 'test'.uniqid(),
'email' => 'test'.uniqid().'@test.com',
'password' => md5('test'.uniqid()),
]);$users = User::paginate(5);
$this->output->set_output(View::make('users', compact('users')));
}
}
```### View
application/views/users.blade.php
```blade
id
name
@foreach ($users as $user)
{{ $user->id }}
{{ $user->name }}
{{ $user->email }}
@endforeach{!! $users->links() !!}
```