Basic Internet Of Things Tutorial Using Raspberry Pi And Laravel Cloud

Submitted by azazqadir - 1 year ago

A basic, easy-to-follow guide on the Internet of Things using Laravel Raspberry Pi.

namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\View;
use Illuminate\Database\Eloquent\Model;
use DB;
class LogController extends Controller
public function showData (){
$results = DB::select('select * from cpu'); //query to fetch all the records in an array
       return View::make('showdata',['data'=>$results]);   //passing this array (results) with a key (data)
       public function storeData ($usage,$status){
       DB::table('cpu')->insert( //insert into table cpu
[ 'date' => DB::raw('now()') , 'time'=> DB::raw('now()') , 'usage'=>$usage , 'status'=>$status]
return response()->json(200); //return 200 response when done.

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks