Skip to content

Instantly share code, notes, and snippets.

@hashihei
Created May 26, 2019 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hashihei/3167137957e1eab88e0f8ceccefb4c6e to your computer and use it in GitHub Desktop.
Save hashihei/3167137957e1eab88e0f8ceccefb4c6e to your computer and use it in GitHub Desktop.
[myfirstcontroller]Model
<?php
namespace App\models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class mysqlModel extends Model
{
//getMariaDBUserlist
public function getUsers()
{
$data = DB::table('user')->pluck('user');
return $data->all();
}
//getMariaDBHostlist
public function getHost()
{
$data = DB::table('user')->pluck('host');
return $data->all();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment