Skip to content

Commit

Permalink
Project is uploaded to repository
Browse files Browse the repository at this point in the history
  • Loading branch information
avijit1258 committed Jul 10, 2016
0 parents commit 9e538c1
Show file tree
Hide file tree
Showing 807 changed files with 195,593 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/Admin.php
@@ -0,0 +1,17 @@
<?php

namespace App;

use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
protected $fillable = [
'name', 'username', 'password', 'active', 'type','modefied_by', 'modefied_at',
];
protected $hidden = [
'password', 'remember_token',
];
protected $guard = "admins";

}
15 changes: 15 additions & 0 deletions app/Company.php
@@ -0,0 +1,15 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Company extends Model
{
protected $fillable = [
'company_name','id','modified_by', 'modification_date',
];
protected $hidden = [

];
}
33 changes: 33 additions & 0 deletions app/Console/Commands/Inspire.php
@@ -0,0 +1,33 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;

class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
30 changes: 30 additions & 0 deletions app/Console/Kernel.php
@@ -0,0 +1,30 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
// Commands\Inspire::class,
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
}
12 changes: 12 additions & 0 deletions app/Counter.php
@@ -0,0 +1,12 @@
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Counter extends Model
{
protected $fillable = [
'counter_name','company_id', 'zone_id', 'modefied_by' , 'modefied_at', 'zone_id' ,
];
}
8 changes: 8 additions & 0 deletions app/Events/Event.php
@@ -0,0 +1,8 @@
<?php

namespace App\Events;

abstract class Event
{
//
}
50 changes: 50 additions & 0 deletions app/Exceptions/Handler.php
@@ -0,0 +1,50 @@
<?php

namespace App\Exceptions;

use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
parent::report($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
return parent::render($request, $e);
}
}
38 changes: 38 additions & 0 deletions app/Http/Controllers/AdminController.php
@@ -0,0 +1,38 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use Crypt;
use Hash;

class AdminController extends Controller
{
public function login(Request $request)
{

if(\Auth::guard('admins')->attempt(['username' => $request->username, 'password' => $request->password]))
{

if(\Auth::guard('admins')->user()->type == "super_admin")
return redirect('users');
elseif (\Auth::guard('admins')->user()->type == "admin") {
return view('admin.admin');
}else
{
return "hahaha";
}
}
return "wrong credentials";

}
public function logout()
{

\Auth::guard('admins')->logout();
\Session::flush();
return redirect('/');
}
}
114 changes: 114 additions & 0 deletions app/Http/Controllers/Auth/AuthController.php
@@ -0,0 +1,114 @@
<?php

namespace App\Http\Controllers\Auth;

use App\User;
use Validator;
use Auth;
use Illuminate\Http\Request;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/

use AuthenticatesAndRegistersUsers, ThrottlesLogins;

/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/';

/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}

/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'username' => 'required|max:255',
// 'email' => 'required|email|max:255|unique:users',
'password' => 'required|min:6|confirmed',
]);
}

/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
return User::create([
'username' => $data['username'],
'name' => $data['name'],
'password' => bcrypt($data['password']),
'type' => $data['type'],
'active' => $data['active'],
'company_id' => $data['company_id'],

]);
}
public function login(Request $request)
{


if (Auth::attempt($request->only('username', 'password')))
{
//return redirect('/home');
//return "welcome admin";
if(Auth::user()->type == 'admin')
return view('company_admin.index');
elseif(Auth::user()->type == 'manager')
return "welcome manager";
elseif(Auth::user()->type == 'counterman')
return view('counterman.index');
else
return "Online user";

}

return redirect('/login')->withErrors([
'email' => 'These credentials do not match our records.',
]);
}
public function showLoginForm(){
return view ('login.userLogin');
}
public function logout()
{

\Auth::logout();
\Session::flush();

return redirect('/');

}
}
32 changes: 32 additions & 0 deletions app/Http/Controllers/Auth/PasswordController.php
@@ -0,0 +1,32 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;

class PasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;

/**
* Create a new password controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}

0 comments on commit 9e538c1

Please sign in to comment.