Commit 9211fb20 by Juliper

add owner page adn list owner

parent f474339c
......@@ -21,6 +21,14 @@ class AdminController extends Controller
return view('adminlte::home');
}
public function listOwner(){
$count = User::all()->where('role',"Owner")->count();
$data = User::all()->where('role',"Owner");
//dd($data);
return view('adminlte::layouts.admin.listOwner')->with('data',$data)->with('count',$count);
}
/**
* Show the form for creating a new resource.
*
......
......@@ -57,6 +57,9 @@ class LoginController extends Controller
if (Auth::user()->role == 'Admin') {
return redirect()->intended('/admin');
}
else if(Auth::user()->role == 'Owner'){
return redirect()->intended('/owner');
}
else {
$validator->errors()->add('password', 'Password tidak benar');
return redirect('/login')
......
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class OwnerController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('adminlte::layouts.owner.home');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="panel panel-default">
<div id="app">
@if (count($errors) > 0)
<div class="alert alert-danger">
<strong>Whoops!</strong> {{ trans('adminlte_lang::message.someproblems') }}<br><br>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<br>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="info-box bg-info">
<span class="info-box-icon bg-yellow"><i class="ion ion-ios-people-outline"></i></span>
<div class="info-box-content">
<span class="info-box-text">List Owner</span>
<span class="info-box-number">{{$count}}</span>
</div>
<!-- /.info-box-content -->
</div>
<!-- /.info-box -->
</div>
<br>
<table class="table table-striped">
<tr>
<th>Name</th>
<th>Username</th>
<th>Email</th>
</tr>
@foreach($data as $a)
<td>{{$a->name}}</td>
<td>{{$a->username}}</td>
<td>{{$a->email}}</td>
@endforeach
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@extends('adminlte::layouts.app')
@section('htmlheader_title')
{{ trans('adminlte_lang::message.home') }}
@endsection
@section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Home</div>
<div class="panel-body">
{{ trans('adminlte_lang::message.logged') }}
</div>
</div>
</div>
</div>
</div>
@endsection
......@@ -36,7 +36,7 @@
<!-- Optionally, you can add icons to the links -->
<li><a href="{{ url('home') }}"><i class='fa fa-home'></i> <span>{{ trans('adminlte_lang::message.home') }}</span></a></li>
<li><a href="{{url('admin/create')}}"><i class='fa fa-plus'></i> <span>{{ trans('adminlte_lang::message.addOwner') }}</span></a></li>
<li><a href="{{url('admin/create')}}"><i class='fa fa-list'></i> <span>{{ trans('adminlte_lang::message.listOwner') }}</span></a></li>
<li><a href="{{url('listowner')}}"><i class='fa fa-list'></i> <span>{{ trans('adminlte_lang::message.listOwner') }}</span></a></li>
@elseif(Auth::user()->role=="Owner")
......
......@@ -30,3 +30,6 @@ Route::group(['middleware' => 'auth'], function () {
Route::resource('admin', 'AdminController');
Route::get('listowner','AdminController@listOwner');
Route::resource('owner','OwnerController');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment