Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e874457008 | ||
|
72e5b83101 | ||
|
8213ae1ec6 | ||
|
fc2da0e280 | ||
|
2fd196c694 | ||
|
48d88cf61b | ||
|
3116d76982 | ||
|
43702d2c24 | ||
|
ed701d9a63 | ||
|
eee570125d | ||
|
70fe3a814c |
@ -4,6 +4,6 @@ APP_DEBUG=true
|
|||||||
|
|
||||||
DB_CONNECTION=sqlite
|
DB_CONNECTION=sqlite
|
||||||
DB_HOST=sqlite
|
DB_HOST=sqlite
|
||||||
DB_DATABASE=:memory:
|
DB_DATABASE=/var/tmp/laraland.db
|
||||||
DB_USERNAME=
|
DB_USERNAME=
|
||||||
DB_PASSWORD=
|
DB_PASSWORD=
|
||||||
|
119
.gitlab-ci.yml
Normal file
119
.gitlab-ci.yml
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
# This file is a template, and might need editing before it works on your project.
|
||||||
|
# Official framework image. Look for the different tagged releases at:
|
||||||
|
# https://hub.docker.com/r/library/php
|
||||||
|
image: registry.waf.or.id/gregorio/laraland:latest
|
||||||
|
|
||||||
|
# Pick zero or more services to be used on all builds.
|
||||||
|
# Only needed when using a docker container to run your tests in.
|
||||||
|
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
|
||||||
|
services:
|
||||||
|
- registry.waf.or.id/gregorio/laraland/mariadb:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
# MYSQL_DATABASE: laraland
|
||||||
|
# MYSQL_ROOT_PASSWORD: secret
|
||||||
|
|
||||||
|
# This folder is cached between builds
|
||||||
|
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- vendor/
|
||||||
|
# - node_modules/
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- functional
|
||||||
|
- staging
|
||||||
|
|
||||||
|
# This is a basic example for a gem or script which doesn't use
|
||||||
|
# services such as redis or postgres
|
||||||
|
before_script:
|
||||||
|
# Add mariadb hostname to hosts file
|
||||||
|
- printf "172.17.0.2 mariadb\n" >> /etc/hosts
|
||||||
|
|
||||||
|
# Update packages
|
||||||
|
- apt-get update -yqq
|
||||||
|
|
||||||
|
# Upgrade to Node 7
|
||||||
|
# - curl -sL https://deb.nodesource.com/setup_7.x | bash -
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
# - apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev mysql-client nodejs -yqq
|
||||||
|
|
||||||
|
# Install php extensions
|
||||||
|
# - docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache
|
||||||
|
|
||||||
|
# Install & enable Xdebug for code coverage reports
|
||||||
|
# - pecl install xdebug
|
||||||
|
# - docker-php-ext-enable xdebug
|
||||||
|
|
||||||
|
# Install Composer and project dependencies.
|
||||||
|
# - curl -sS https://getcomposer.org/installer | php
|
||||||
|
# - php composer.phar install
|
||||||
|
- composer install
|
||||||
|
|
||||||
|
# Install Node dependencies.
|
||||||
|
# comment this out if you don't have a node dependency
|
||||||
|
# - npm install
|
||||||
|
|
||||||
|
# Copy over testing configuration.
|
||||||
|
# Don't forget to set the database config in .env.testing correctly
|
||||||
|
# DB_HOST=mysql
|
||||||
|
# DB_DATABASE=project_name
|
||||||
|
# DB_USERNAME=root
|
||||||
|
# DB_PASSWORD=secret
|
||||||
|
- cp .env.testing .env
|
||||||
|
|
||||||
|
# Generate database file
|
||||||
|
- touch /var/tmp/laraland.db
|
||||||
|
|
||||||
|
# Run npm build
|
||||||
|
# comment this out if you don't have a frontend build
|
||||||
|
# you can change this to to your frontend building script like
|
||||||
|
# npm run build
|
||||||
|
# - npm run dev
|
||||||
|
|
||||||
|
# Generate an application key. Re-cache.
|
||||||
|
- php artisan key:generate
|
||||||
|
- php artisan config:cache
|
||||||
|
|
||||||
|
# Run database migrations.
|
||||||
|
- php artisan migrate
|
||||||
|
- php artisan module:migrate
|
||||||
|
|
||||||
|
# Run database seed
|
||||||
|
# - php artisan db:seed
|
||||||
|
# - php artisan module:seed
|
||||||
|
|
||||||
|
# Generate passport password client
|
||||||
|
- php artisan passport:client --password --name=laraland
|
||||||
|
|
||||||
|
frameworktest:
|
||||||
|
stage: functional
|
||||||
|
|
||||||
|
script:
|
||||||
|
# run laravel tests
|
||||||
|
# - php vendor/bin/phpunit --coverage-text --colors=never
|
||||||
|
- php vendor/bin/codecept run functional
|
||||||
|
- php vendor/bin/codecept run functional -c Modules/Karyawaf
|
||||||
|
|
||||||
|
# run frontend tests
|
||||||
|
# if you have any task for testing frontend
|
||||||
|
# set it in your package.json script
|
||||||
|
# comment this out if you don't have a frontend test
|
||||||
|
# - npm test
|
||||||
|
|
||||||
|
uploadstaging:
|
||||||
|
stage: staging
|
||||||
|
|
||||||
|
script:
|
||||||
|
# store ssh variables into file
|
||||||
|
- mkdir /root/.ssh
|
||||||
|
- echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
|
||||||
|
- echo "$SSH_PUBLIC_KEY" > /root/.ssh/id_rsa.pub
|
||||||
|
- echo "$SSH_REMOTE_HOST" > /root/.ssh/known_hosts
|
||||||
|
|
||||||
|
# create permission for ssh files
|
||||||
|
- chmod -R 600 /root/.ssh
|
||||||
|
|
||||||
|
# run the test
|
||||||
|
- vendor/bin/robo test:server
|
84
.gitlab-ci.yml.orig
Normal file
84
.gitlab-ci.yml.orig
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# This file is a template, and might need editing before it works on your project.
|
||||||
|
# Official framework image. Look for the different tagged releases at:
|
||||||
|
# https://hub.docker.com/r/library/php
|
||||||
|
image: php:latest
|
||||||
|
|
||||||
|
# Pick zero or more services to be used on all builds.
|
||||||
|
# Only needed when using a docker container to run your tests in.
|
||||||
|
# Check out: http://docs.gitlab.com/ce/ci/docker/using_docker_images.html#what-is-a-service
|
||||||
|
services:
|
||||||
|
- mysql:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MYSQL_DATABASE: laraland
|
||||||
|
MYSQL_ROOT_PASSWORD: root
|
||||||
|
|
||||||
|
# This folder is cached between builds
|
||||||
|
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- vendor/
|
||||||
|
# - node_modules/
|
||||||
|
|
||||||
|
# This is a basic example for a gem or script which doesn't use
|
||||||
|
# services such as redis or postgres
|
||||||
|
before_script:
|
||||||
|
# Update packages
|
||||||
|
- apt-get update -yqq
|
||||||
|
|
||||||
|
# Upgrade to Node 7
|
||||||
|
# - curl -sL https://deb.nodesource.com/setup_7.x | bash -
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
- apt-get install git libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev -yqq
|
||||||
|
# nodejs
|
||||||
|
|
||||||
|
# Install php extensions
|
||||||
|
- docker-php-ext-install mbstring pdo_mysql curl json intl gd xml zip bz2 opcache
|
||||||
|
|
||||||
|
# Install & enable Xdebug for code coverage reports
|
||||||
|
- pecl install xdebug
|
||||||
|
- docker-php-ext-enable xdebug
|
||||||
|
|
||||||
|
# Install Composer and project dependencies.
|
||||||
|
- curl -sS https://getcomposer.org/installer | php
|
||||||
|
- php composer.phar install
|
||||||
|
|
||||||
|
# Install Node dependencies.
|
||||||
|
# comment this out if you don't have a node dependency
|
||||||
|
# - npm install
|
||||||
|
|
||||||
|
# Copy over testing configuration.
|
||||||
|
# Don't forget to set the database config in .env.testing correctly
|
||||||
|
# DB_HOST=mysql
|
||||||
|
# DB_DATABASE=project_name
|
||||||
|
# DB_USERNAME=root
|
||||||
|
# DB_PASSWORD=secret
|
||||||
|
- cp .env.testing .env
|
||||||
|
|
||||||
|
# Run npm build
|
||||||
|
# comment this out if you don't have a frontend build
|
||||||
|
# you can change this to to your frontend building script like
|
||||||
|
# npm run build
|
||||||
|
# - npm run dev
|
||||||
|
|
||||||
|
# Generate an application key. Re-cache.
|
||||||
|
- php artisan key:generate
|
||||||
|
- php artisan config:cache
|
||||||
|
|
||||||
|
# Run database migrations.
|
||||||
|
# - php artisan migrate
|
||||||
|
|
||||||
|
# Run database seed
|
||||||
|
# - php artisan db:seed
|
||||||
|
|
||||||
|
test:
|
||||||
|
script:
|
||||||
|
# run laravel tests
|
||||||
|
- php vendor/bin/phpunit --coverage-text --colors=never
|
||||||
|
|
||||||
|
# run frontend tests
|
||||||
|
# if you have any task for testing frontend
|
||||||
|
# set it in your package.json script
|
||||||
|
# comment this out if you don't have a frontend test
|
||||||
|
# - npm test
|
47
Dockerfile
Normal file
47
Dockerfile
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
FROM debian:stretch
|
||||||
|
MAINTAINER Gregorio Chiko <gregorio@lepisi.ac.id>
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
apt-transport-https \
|
||||||
|
lsb-release \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
git \
|
||||||
|
zip \
|
||||||
|
unzip \
|
||||||
|
sudo \
|
||||||
|
wget \
|
||||||
|
gnupg1 \
|
||||||
|
openssh-server \
|
||||||
|
openssh-client
|
||||||
|
|
||||||
|
ADD https://packages.sury.org/php/apt.gpg /etc/apt/trusted.gpg.d/php.gpg
|
||||||
|
RUN sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
|
||||||
|
RUN chmod 664 /etc/apt/trusted.gpg.d/php.gpg
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
php7.2-fpm \
|
||||||
|
php7.2-cli \
|
||||||
|
php7.2-mysql \
|
||||||
|
php7.2-mbstring \
|
||||||
|
php7.2-json \
|
||||||
|
php7.2-sqlite3 \
|
||||||
|
php7.2-xml \
|
||||||
|
php7.2-curl \
|
||||||
|
php7.2-zip \
|
||||||
|
php7.2-intl \
|
||||||
|
php7.2-gd \
|
||||||
|
php7.2-bz2 \
|
||||||
|
php7.2-opcache
|
||||||
|
|
||||||
|
RUN apt-get install -y \
|
||||||
|
git \
|
||||||
|
libcurl4-gnutls-dev libicu-dev libmcrypt-dev libvpx-dev libjpeg-dev libpng-dev libxpm-dev zlib1g-dev libfreetype6-dev libxml2-dev libexpat1-dev libbz2-dev libgmp3-dev libldap2-dev unixodbc-dev libpq-dev libsqlite3-dev libaspell-dev libsnmp-dev libpcre3-dev libtidy-dev mysql-client
|
||||||
|
|
||||||
|
COPY --from=composer:1.5 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
RUN php -v && \
|
||||||
|
git --version && \
|
||||||
|
composer --version
|
0
Modules/Karyawaf/Config/.gitkeep
Normal file
0
Modules/Karyawaf/Config/.gitkeep
Normal file
5
Modules/Karyawaf/Config/config.php
Normal file
5
Modules/Karyawaf/Config/config.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'Karyawaf'
|
||||||
|
];
|
0
Modules/Karyawaf/Console/.gitkeep
Normal file
0
Modules/Karyawaf/Console/.gitkeep
Normal file
0
Modules/Karyawaf/Database/Migrations/.gitkeep
Normal file
0
Modules/Karyawaf/Database/Migrations/.gitkeep
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateKaryawansTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('karyawans', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('nama', 50);
|
||||||
|
$table->string('posisi', 50);
|
||||||
|
$table->string('tempat_lahir', 20);
|
||||||
|
$table->datetime('tanggal_lahir');
|
||||||
|
$table->datetime('rekrut');
|
||||||
|
$table->boolean('status');
|
||||||
|
$table->unsignedInteger('created_by');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
|
||||||
|
$table->foreign('created_by')
|
||||||
|
->references('id')
|
||||||
|
->on('users')
|
||||||
|
->onUpdate('cascade')
|
||||||
|
->onDelete('restrict');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('karyawans');
|
||||||
|
}
|
||||||
|
}
|
0
Modules/Karyawaf/Database/Seeders/.gitkeep
Normal file
0
Modules/Karyawaf/Database/Seeders/.gitkeep
Normal file
21
Modules/Karyawaf/Database/Seeders/KaryawafDatabaseSeeder.php
Normal file
21
Modules/Karyawaf/Database/Seeders/KaryawafDatabaseSeeder.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class KaryawafDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
$this->call(KaryawansTableSeeder::class);
|
||||||
|
}
|
||||||
|
}
|
21
Modules/Karyawaf/Database/Seeders/KaryawansTableSeeder.php
Normal file
21
Modules/Karyawaf/Database/Seeders/KaryawansTableSeeder.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class KaryawansTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
factory(\Modules\Karyawaf\Entities\Karyawan::class)->create();
|
||||||
|
}
|
||||||
|
}
|
0
Modules/Karyawaf/Database/factories/.gitkeep
Normal file
0
Modules/Karyawaf/Database/factories/.gitkeep
Normal file
15
Modules/Karyawaf/Database/factories/KaryawansFactory.php
Normal file
15
Modules/Karyawaf/Database/factories/KaryawansFactory.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Faker\Generator as Faker;
|
||||||
|
|
||||||
|
$factory->define(Modules\Karyawaf\Entities\Karyawan::class, function (Faker $faker) {
|
||||||
|
return [
|
||||||
|
'nama' => $faker->name(),
|
||||||
|
'posisi' => $faker->jobTitle(),
|
||||||
|
'tempat_lahir' => $faker->city(),
|
||||||
|
'tanggal_lahir' => Carbon\Carbon::instance($faker->dateTimeBetween('-50 years', '-19 years', 'Asia/Jakarta')),
|
||||||
|
'rekrut' => Carbon\Carbon::instance($faker->dateTimeBetween('-10 years', '-1 year', 'Asia/Jakarta')),
|
||||||
|
'status' => 1,
|
||||||
|
'created_by' => App\User::find(1)->id
|
||||||
|
];
|
||||||
|
});
|
0
Modules/Karyawaf/Entities/.gitkeep
Normal file
0
Modules/Karyawaf/Entities/.gitkeep
Normal file
38
Modules/Karyawaf/Entities/Karyawan.php
Normal file
38
Modules/Karyawaf/Entities/Karyawan.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Entities;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Sofa\Eloquence\Eloquence;
|
||||||
|
use Sofa\Eloquence\Validable;
|
||||||
|
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||||
|
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||||
|
use Watson\Validating\ValidatingTrait;
|
||||||
|
|
||||||
|
class Karyawan extends Model implements ValidableContract, CleansAttributes
|
||||||
|
{
|
||||||
|
use SoftDeletes, Eloquence, Validable; // ValidatingTrait
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'nama', 'posisi', 'tempat_lahir', 'tanggal_lahir', 'rekrut', 'status',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'tanggal_lahir', 'created_at', 'updated_at', 'deleted_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static $businessRules = [ // $rules = []
|
||||||
|
'nama' => 'required|string|min:5',
|
||||||
|
'posisi' => 'required|string|min:3',
|
||||||
|
'tempat_lahir' => 'required|string|min:3',
|
||||||
|
'tanggal_lahir' => 'required|date',
|
||||||
|
'rekrut' => 'required|date',
|
||||||
|
'status' => 'required|integer'
|
||||||
|
];
|
||||||
|
|
||||||
|
public function creator()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(\App\User::class, 'created_by');
|
||||||
|
}
|
||||||
|
}
|
0
Modules/Karyawaf/Http/Controllers/.gitkeep
Normal file
0
Modules/Karyawaf/Http/Controllers/.gitkeep
Normal file
72
Modules/Karyawaf/Http/Controllers/KaryawafController.php
Normal file
72
Modules/Karyawaf/Http/Controllers/KaryawafController.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
|
||||||
|
class KaryawafController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('karyawaf::index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('karyawaf::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show()
|
||||||
|
{
|
||||||
|
return view('karyawaf::show');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
return view('karyawaf::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param Request $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update(Request $request)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
133
Modules/Karyawaf/Http/Controllers/KaryawanController.php
Normal file
133
Modules/Karyawaf/Http/Controllers/KaryawanController.php
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Modules\Karyawaf\Entities\Karyawan;
|
||||||
|
use Modules\Karyawaf\Http\Requests\StoreKaryawafKaryawan;
|
||||||
|
use Modules\Karyawaf\Http\Requests\UpdateKaryawafKaryawan;
|
||||||
|
|
||||||
|
class KaryawanController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
// $response = Karyawan::all();
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'data' => $response
|
||||||
|
// ]);
|
||||||
|
return responder()
|
||||||
|
->success(Karyawan::all())
|
||||||
|
->meta(['count' => Karyawan::count()])
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for creating a new resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
return view('karyawaf::create');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage.
|
||||||
|
* @param StoreKaryawafKaryawan $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store(StoreKaryawafKaryawan $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$response = Auth::user()->karyawans()->create($validated); // Auth::user()->karyawan->create()
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'data' => $response
|
||||||
|
// ]);
|
||||||
|
return responder()
|
||||||
|
->success($response)
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource.
|
||||||
|
* @param $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$response = Karyawan::find($id);
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'data' => $response
|
||||||
|
// ]);
|
||||||
|
if (!$response) {
|
||||||
|
return responder()
|
||||||
|
->error('karyawan_error', 'Cannot find `karyawan` with id ' . $id)
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
return responder()
|
||||||
|
->success($response)
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the form for editing the specified resource.
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
return view('karyawaf::edit');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage.
|
||||||
|
* @param UpdateKaryawafKaryawan $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update(UpdateKaryawafKaryawan $request, $id)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::findOrFail($id);
|
||||||
|
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$karyawan->update($validated);
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'data' => $karyawan
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
return responder()
|
||||||
|
->success($karyawan)
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage.
|
||||||
|
* @param $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::findOrFail($id);
|
||||||
|
|
||||||
|
$karyawan->delete();
|
||||||
|
|
||||||
|
// return response()->json([
|
||||||
|
// 'message' => 'The data has been deleted'
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
return responder()
|
||||||
|
->success(['message' => 'The data has been deleted'])
|
||||||
|
->respond();
|
||||||
|
}
|
||||||
|
}
|
0
Modules/Karyawaf/Http/Middleware/.gitkeep
Normal file
0
Modules/Karyawaf/Http/Middleware/.gitkeep
Normal file
0
Modules/Karyawaf/Http/Requests/.gitkeep
Normal file
0
Modules/Karyawaf/Http/Requests/.gitkeep
Normal file
30
Modules/Karyawaf/Http/Requests/StoreKaryawafKaryawan.php
Normal file
30
Modules/Karyawaf/Http/Requests/StoreKaryawafKaryawan.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Modules\Karyawaf\Entities\Karyawan;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class StoreKaryawafKaryawan extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return Karyawan::getCreateRules();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('create-karyawan');
|
||||||
|
}
|
||||||
|
}
|
32
Modules/Karyawaf/Http/Requests/UpdateKaryawafKaryawan.php
Normal file
32
Modules/Karyawaf/Http/Requests/UpdateKaryawafKaryawan.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Modules\Karyawaf\Entities\Karyawan;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UpdateKaryawafKaryawan extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
$id = $this->karyawan;
|
||||||
|
|
||||||
|
return Karyawan::getUpdateRulesForId($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('update-karyawan');
|
||||||
|
}
|
||||||
|
}
|
18
Modules/Karyawaf/Http/routes.php
Normal file
18
Modules/Karyawaf/Http/routes.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
Route::group(['middleware' => 'web', 'prefix' => 'karyawaf', 'namespace' => 'Modules\Karyawaf\Http\Controllers'], function()
|
||||||
|
{
|
||||||
|
Route::get('/', 'KaryawafController@index');
|
||||||
|
});
|
||||||
|
|
||||||
|
Route::group(['middleware' => ['api', 'auth:api'], 'prefix' => 'api/karyawaf', 'namespace' => 'Modules\Karyawaf\Http\Controllers'], function()
|
||||||
|
{
|
||||||
|
Route::group(['prefix' => 'karyawans'], function()
|
||||||
|
{
|
||||||
|
Route::get('/', 'KaryawanController@index');
|
||||||
|
Route::post('/', 'KaryawanController@store');
|
||||||
|
Route::get('/{karyawan}', 'KaryawanController@show');
|
||||||
|
Route::put('/{karyawan}', 'KaryawanController@update');
|
||||||
|
Route::delete('/{karyawan}', 'KaryawanController@destroy');
|
||||||
|
});
|
||||||
|
});
|
0
Modules/Karyawaf/Providers/.gitkeep
Normal file
0
Modules/Karyawaf/Providers/.gitkeep
Normal file
113
Modules/Karyawaf/Providers/KaryawafServiceProvider.php
Normal file
113
Modules/Karyawaf/Providers/KaryawafServiceProvider.php
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Karyawaf\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
|
||||||
|
class KaryawafServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Indicates if loading of the provider is deferred.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $defer = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
$this->registerViews();
|
||||||
|
$this->registerFactories();
|
||||||
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/../Config/config.php' => config_path('karyawaf.php'),
|
||||||
|
], 'config');
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
__DIR__.'/../Config/config.php', 'karyawaf'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register views.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerViews()
|
||||||
|
{
|
||||||
|
$viewPath = resource_path('views/modules/karyawaf');
|
||||||
|
|
||||||
|
$sourcePath = __DIR__.'/../Resources/views';
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
$sourcePath => $viewPath
|
||||||
|
],'views');
|
||||||
|
|
||||||
|
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||||
|
return $path . '/modules/karyawaf';
|
||||||
|
}, \Config::get('view.paths')), [$sourcePath]), 'karyawaf');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/karyawaf');
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, 'karyawaf');
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'karyawaf');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an additional directory of factories.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function registerFactories()
|
||||||
|
{
|
||||||
|
if (! app()->environment('production')) {
|
||||||
|
app(Factory::class)->load(__DIR__ . '/../Database/factories');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the services provided by the provider.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function provides()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
0
Modules/Karyawaf/Resources/assets/.gitkeep
Normal file
0
Modules/Karyawaf/Resources/assets/.gitkeep
Normal file
0
Modules/Karyawaf/Resources/assets/js/app.js
vendored
Normal file
0
Modules/Karyawaf/Resources/assets/js/app.js
vendored
Normal file
0
Modules/Karyawaf/Resources/assets/sass/app.scss
vendored
Normal file
0
Modules/Karyawaf/Resources/assets/sass/app.scss
vendored
Normal file
0
Modules/Karyawaf/Resources/lang/.gitkeep
Normal file
0
Modules/Karyawaf/Resources/lang/.gitkeep
Normal file
0
Modules/Karyawaf/Resources/views/.gitkeep
Normal file
0
Modules/Karyawaf/Resources/views/.gitkeep
Normal file
9
Modules/Karyawaf/Resources/views/index.blade.php
Normal file
9
Modules/Karyawaf/Resources/views/index.blade.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
@extends('karyawaf::layouts.master')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This view is loaded from module: {!! config('karyawaf.name') !!}
|
||||||
|
</p>
|
||||||
|
@stop
|
19
Modules/Karyawaf/Resources/views/layouts/master.blade.php
Normal file
19
Modules/Karyawaf/Resources/views/layouts/master.blade.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>Module Karyawaf</title>
|
||||||
|
|
||||||
|
{{-- Laravel Mix - CSS File --}}
|
||||||
|
{{-- <link rel="stylesheet" href="{{ mix('css/karyawaf.css') }}"> --}}
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@yield('content')
|
||||||
|
|
||||||
|
{{-- Laravel Mix - JS File --}}
|
||||||
|
{{-- <script src="{{ mix('js/karyawaf.js') }}"></script> --}}
|
||||||
|
</body>
|
||||||
|
</html>
|
0
Modules/Karyawaf/Tests/.gitkeep
Normal file
0
Modules/Karyawaf/Tests/.gitkeep
Normal file
0
Modules/Karyawaf/Tests/_data/.gitkeep
Normal file
0
Modules/Karyawaf/Tests/_data/.gitkeep
Normal file
0
Modules/Karyawaf/Tests/_output/.gitkeep
Normal file
0
Modules/Karyawaf/Tests/_output/.gitkeep
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"status":200,"success":true,"data":{"message":"The data has been removed"}}
|
@ -0,0 +1,112 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- CSRF Token -->
|
||||||
|
<meta name="csrf-token" content="D6GwDNadSIi9cwSoBhFJKf0Qu8gFmLcRSqUoDHWM">
|
||||||
|
|
||||||
|
<title>Laravel</title>
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
|
<link href="http://laraland.test/css/app.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<nav class="navbar navbar-default navbar-static-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
|
||||||
|
<!-- Collapsed Hamburger -->
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle Navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Branding Image -->
|
||||||
|
<a class="navbar-brand" href="http://laraland.test">
|
||||||
|
Laravel
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="app-navbar-collapse">
|
||||||
|
<!-- Left Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Right Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<!-- Authentication Links -->
|
||||||
|
<li><a href="http://laraland.test/login">Login</a></li>
|
||||||
|
<li><a href="http://laraland.test/register">Register</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Login</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" method="POST" action="http://laraland.test/login">
|
||||||
|
<input type="hidden" name="_token" value="D6GwDNadSIi9cwSoBhFJKf0Qu8gFmLcRSqUoDHWM">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="" required autofocus>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password" class="col-md-4 control-label">Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="remember" > Remember Me
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-8 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="btn btn-link" href="http://laraland.test/password/reset">
|
||||||
|
Forgot Your Password?
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="http://laraland.test/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,112 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- CSRF Token -->
|
||||||
|
<meta name="csrf-token" content="SCpi5vt8cjvm18U3hkVK4G1eN1R8q5Th36AiZxpS">
|
||||||
|
|
||||||
|
<title>Laravel</title>
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
|
<link href="http://laraland.test/css/app.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<nav class="navbar navbar-default navbar-static-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
|
||||||
|
<!-- Collapsed Hamburger -->
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle Navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Branding Image -->
|
||||||
|
<a class="navbar-brand" href="http://laraland.test">
|
||||||
|
Laravel
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="app-navbar-collapse">
|
||||||
|
<!-- Left Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Right Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<!-- Authentication Links -->
|
||||||
|
<li><a href="http://laraland.test/login">Login</a></li>
|
||||||
|
<li><a href="http://laraland.test/register">Register</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Login</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" method="POST" action="http://laraland.test/login">
|
||||||
|
<input type="hidden" name="_token" value="SCpi5vt8cjvm18U3hkVK4G1eN1R8q5Th36AiZxpS">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="" required autofocus>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password" class="col-md-4 control-label">Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="remember" > Remember Me
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-8 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="btn btn-link" href="http://laraland.test/password/reset">
|
||||||
|
Forgot Your Password?
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="http://laraland.test/js/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
1449
Modules/Karyawaf/Tests/_output/ApiKaryawansCest.storeData.fail.html
Normal file
1449
Modules/Karyawaf/Tests/_output/ApiKaryawansCest.storeData.fail.html
Normal file
File diff suppressed because one or more lines are too long
10668
Modules/Karyawaf/Tests/_output/ApiKaryawansCest.updateData.fail.html
Normal file
10668
Modules/Karyawaf/Tests/_output/ApiKaryawansCest.updateData.fail.html
Normal file
File diff suppressed because one or more lines are too long
26
Modules/Karyawaf/Tests/_support/AcceptanceTester.php
Normal file
26
Modules/Karyawaf/Tests/_support/AcceptanceTester.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class AcceptanceTester extends \Codeception\Actor
|
||||||
|
{
|
||||||
|
use _generated\AcceptanceTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
26
Modules/Karyawaf/Tests/_support/FunctionalTester.php
Normal file
26
Modules/Karyawaf/Tests/_support/FunctionalTester.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class FunctionalTester extends \Codeception\Actor
|
||||||
|
{
|
||||||
|
use _generated\FunctionalTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
10
Modules/Karyawaf/Tests/_support/Helper/Acceptance.php
Normal file
10
Modules/Karyawaf/Tests/_support/Helper/Acceptance.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace Helper;
|
||||||
|
|
||||||
|
// here you can define custom actions
|
||||||
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
class Acceptance extends \Codeception\Module
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
10
Modules/Karyawaf/Tests/_support/Helper/Functional.php
Normal file
10
Modules/Karyawaf/Tests/_support/Helper/Functional.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace Helper;
|
||||||
|
|
||||||
|
// here you can define custom actions
|
||||||
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
class Functional extends \Codeception\Module
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
10
Modules/Karyawaf/Tests/_support/Helper/Unit.php
Normal file
10
Modules/Karyawaf/Tests/_support/Helper/Unit.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
namespace Helper;
|
||||||
|
|
||||||
|
// here you can define custom actions
|
||||||
|
// all public methods declared in helper class will be available in $I
|
||||||
|
|
||||||
|
class Unit extends \Codeception\Module
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
26
Modules/Karyawaf/Tests/_support/UnitTester.php
Normal file
26
Modules/Karyawaf/Tests/_support/UnitTester.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inherited Methods
|
||||||
|
* @method void wantToTest($text)
|
||||||
|
* @method void wantTo($text)
|
||||||
|
* @method void execute($callable)
|
||||||
|
* @method void expectTo($prediction)
|
||||||
|
* @method void expect($prediction)
|
||||||
|
* @method void amGoingTo($argumentation)
|
||||||
|
* @method void am($role)
|
||||||
|
* @method void lookForwardTo($achieveValue)
|
||||||
|
* @method void comment($description)
|
||||||
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
|
||||||
|
*
|
||||||
|
* @SuppressWarnings(PHPMD)
|
||||||
|
*/
|
||||||
|
class UnitTester extends \Codeception\Actor
|
||||||
|
{
|
||||||
|
use _generated\UnitTesterActions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define custom actions here
|
||||||
|
*/
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
573
Modules/Karyawaf/Tests/_support/_generated/UnitTesterActions.php
Normal file
573
Modules/Karyawaf/Tests/_support/_generated/UnitTesterActions.php
Normal file
@ -0,0 +1,573 @@
|
|||||||
|
<?php //[STAMP] 64428e31d2df7509037bed5e388a6dee
|
||||||
|
namespace _generated;
|
||||||
|
|
||||||
|
// This class was automatically generated by build task
|
||||||
|
// You should not change it manually as it will be overwritten on next build
|
||||||
|
// @codingStandardsIgnoreFile
|
||||||
|
|
||||||
|
trait UnitTesterActions
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return \Codeception\Scenario
|
||||||
|
*/
|
||||||
|
abstract protected function getScenario();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that two variables are equal. If you're comparing floating-point values,
|
||||||
|
* you can specify the optional "delta" parameter which dictates how great of a precision
|
||||||
|
* error are you willing to tolerate in order to consider the two values equal.
|
||||||
|
*
|
||||||
|
* Regular example:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->assertEquals($element->getChildrenCount(), 5);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Floating-point example:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @param float $delta
|
||||||
|
* @see \Codeception\Module\Asserts::assertEquals()
|
||||||
|
*/
|
||||||
|
public function assertEquals($expected, $actual, $message = null, $delta = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that two variables are not equal. If you're comparing floating-point values,
|
||||||
|
* you can specify the optional "delta" parameter which dictates how great of a precision
|
||||||
|
* error are you willing to tolerate in order to consider the two values not equal.
|
||||||
|
*
|
||||||
|
* Regular example:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->assertNotEquals($element->getChildrenCount(), 0);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Floating-point example:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @param float $delta
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotEquals()
|
||||||
|
*/
|
||||||
|
public function assertNotEquals($expected, $actual, $message = null, $delta = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that two variables are same
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertSame()
|
||||||
|
*/
|
||||||
|
public function assertSame($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that two variables are not same
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotSame()
|
||||||
|
*/
|
||||||
|
public function assertNotSame($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that actual is greater than expected
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertGreaterThan()
|
||||||
|
*/
|
||||||
|
public function assertGreaterThan($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that actual is greater or equal than expected
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertGreaterThanOrEqual()
|
||||||
|
*/
|
||||||
|
public function assertGreaterThanOrEqual($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that actual is less than expected
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertLessThan()
|
||||||
|
*/
|
||||||
|
public function assertLessThan($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that actual is less or equal than expected
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertLessThanOrEqual()
|
||||||
|
*/
|
||||||
|
public function assertLessThanOrEqual($expected, $actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that haystack contains needle
|
||||||
|
*
|
||||||
|
* @param $needle
|
||||||
|
* @param $haystack
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertContains()
|
||||||
|
*/
|
||||||
|
public function assertContains($needle, $haystack, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that haystack doesn't contain needle.
|
||||||
|
*
|
||||||
|
* @param $needle
|
||||||
|
* @param $haystack
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotContains()
|
||||||
|
*/
|
||||||
|
public function assertNotContains($needle, $haystack, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that string match with pattern
|
||||||
|
*
|
||||||
|
* @param string $pattern
|
||||||
|
* @param string $string
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertRegExp()
|
||||||
|
*/
|
||||||
|
public function assertRegExp($pattern, $string, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that string not match with pattern
|
||||||
|
*
|
||||||
|
* @param string $pattern
|
||||||
|
* @param string $string
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotRegExp()
|
||||||
|
*/
|
||||||
|
public function assertNotRegExp($pattern, $string, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that a string starts with the given prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix
|
||||||
|
* @param string $string
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertStringStartsWith()
|
||||||
|
*/
|
||||||
|
public function assertStringStartsWith($prefix, $string, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that a string doesn't start with the given prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix
|
||||||
|
* @param string $string
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertStringStartsNotWith()
|
||||||
|
*/
|
||||||
|
public function assertStringStartsNotWith($prefix, $string, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that variable is empty.
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertEmpty()
|
||||||
|
*/
|
||||||
|
public function assertEmpty($actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that variable is not empty.
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotEmpty()
|
||||||
|
*/
|
||||||
|
public function assertNotEmpty($actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that variable is NULL
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNull()
|
||||||
|
*/
|
||||||
|
public function assertNull($actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that variable is not NULL
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotNull()
|
||||||
|
*/
|
||||||
|
public function assertNotNull($actual, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that condition is positive.
|
||||||
|
*
|
||||||
|
* @param $condition
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertTrue()
|
||||||
|
*/
|
||||||
|
public function assertTrue($condition, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that the condition is NOT true (everything but true)
|
||||||
|
*
|
||||||
|
* @param $condition
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotTrue()
|
||||||
|
*/
|
||||||
|
public function assertNotTrue($condition, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that condition is negative.
|
||||||
|
*
|
||||||
|
* @param $condition
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertFalse()
|
||||||
|
*/
|
||||||
|
public function assertFalse($condition, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that the condition is NOT false (everything but false)
|
||||||
|
*
|
||||||
|
* @param $condition
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotFalse()
|
||||||
|
*/
|
||||||
|
public function assertNotFalse($condition, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks if file exists
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertFileExists()
|
||||||
|
*/
|
||||||
|
public function assertFileExists($filename, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks if file doesn't exist
|
||||||
|
*
|
||||||
|
* @param string $filename
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertFileNotExists()
|
||||||
|
*/
|
||||||
|
public function assertFileNotExists($filename, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertGreaterOrEquals()
|
||||||
|
*/
|
||||||
|
public function assertGreaterOrEquals($expected, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expected
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertLessOrEquals()
|
||||||
|
*/
|
||||||
|
public function assertLessOrEquals($expected, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertIsEmpty()
|
||||||
|
*/
|
||||||
|
public function assertIsEmpty($actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertArrayHasKey()
|
||||||
|
*/
|
||||||
|
public function assertArrayHasKey($key, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $key
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertArrayNotHasKey()
|
||||||
|
*/
|
||||||
|
public function assertArrayNotHasKey($key, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Checks that array contains subset.
|
||||||
|
*
|
||||||
|
* @param array $subset
|
||||||
|
* @param array $array
|
||||||
|
* @param bool $strict
|
||||||
|
* @param string $message
|
||||||
|
* @see \Codeception\Module\Asserts::assertArraySubset()
|
||||||
|
*/
|
||||||
|
public function assertArraySubset($subset, $array, $strict = null, $message = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $expectedCount
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertCount()
|
||||||
|
*/
|
||||||
|
public function assertCount($expectedCount, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $class
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertInstanceOf()
|
||||||
|
*/
|
||||||
|
public function assertInstanceOf($class, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $class
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertNotInstanceOf()
|
||||||
|
*/
|
||||||
|
public function assertNotInstanceOf($class, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* @param $type
|
||||||
|
* @param $actual
|
||||||
|
* @param $description
|
||||||
|
* @see \Codeception\Module\Asserts::assertInternalType()
|
||||||
|
*/
|
||||||
|
public function assertInternalType($type, $actual, $description = null) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Fails the test with message.
|
||||||
|
*
|
||||||
|
* @param $message
|
||||||
|
* @see \Codeception\Module\Asserts::fail()
|
||||||
|
*/
|
||||||
|
public function fail($message) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* [!] Method is generated. Documentation taken from corresponding module.
|
||||||
|
*
|
||||||
|
* Handles and checks exception called inside callback function.
|
||||||
|
* Either exception class name or exception instance should be provided.
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* $I->expectException(MyException::class, function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
*
|
||||||
|
* $I->expectException(new MyException(), function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* If you want to check message or exception code, you can pass them with exception instance:
|
||||||
|
* ```php
|
||||||
|
* <?php
|
||||||
|
* // will check that exception MyException is thrown with "Don't do bad things" message
|
||||||
|
* $I->expectException(new MyException("Don't do bad things"), function() {
|
||||||
|
* $this->doSomethingBad();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param $exception string or \Exception
|
||||||
|
* @param $callback
|
||||||
|
* @see \Codeception\Module\Asserts::expectException()
|
||||||
|
*/
|
||||||
|
public function expectException($exception, $callback) {
|
||||||
|
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
|
||||||
|
}
|
||||||
|
}
|
12
Modules/Karyawaf/Tests/acceptance.suite.yml
Normal file
12
Modules/Karyawaf/Tests/acceptance.suite.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Codeception Test Suite Configuration
|
||||||
|
#
|
||||||
|
# Suite for acceptance tests.
|
||||||
|
# Perform tests in browser using the WebDriver or PhpBrowser.
|
||||||
|
# If you need both WebDriver and PHPBrowser tests - create a separate suite.
|
||||||
|
|
||||||
|
actor: AcceptanceTester
|
||||||
|
modules:
|
||||||
|
enabled:
|
||||||
|
- PhpBrowser:
|
||||||
|
url: http://localhost/myapp
|
||||||
|
- \Helper\Acceptance
|
18
Modules/Karyawaf/Tests/functional.suite.yml
Normal file
18
Modules/Karyawaf/Tests/functional.suite.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Codeception Test Suite Configuration
|
||||||
|
#
|
||||||
|
# Suite for functional tests
|
||||||
|
# Emulate web requests and make application process them
|
||||||
|
# Include one of framework modules (Symfony2, Yii2, Laravel5) to use it
|
||||||
|
# Remove this suite if you don't use frameworks
|
||||||
|
|
||||||
|
actor: FunctionalTester
|
||||||
|
modules:
|
||||||
|
enabled:
|
||||||
|
# add a framework module here
|
||||||
|
- Laravel5:
|
||||||
|
environment_file: .env.testing
|
||||||
|
packages: 'Modules/Karyawaf'
|
||||||
|
cleanup: true
|
||||||
|
- REST:
|
||||||
|
depends: Laravel5
|
||||||
|
- \Helper\Functional
|
115
Modules/Karyawaf/Tests/functional/ApiKaryawansCest.php
Normal file
115
Modules/Karyawaf/Tests/functional/ApiKaryawansCest.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Modules\Karyawaf\Entities\Karyawan;
|
||||||
|
use Laravel\Passport\Passport;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Admin;
|
||||||
|
|
||||||
|
class ApiKaryawansCest
|
||||||
|
{
|
||||||
|
private $endpoint = '/api/karyawaf/karyawans';
|
||||||
|
|
||||||
|
private function initDatabase()
|
||||||
|
{
|
||||||
|
Artisan::call('migrate:refresh');
|
||||||
|
Artisan::call('module:migrate-refresh', ['Karyawaf']);
|
||||||
|
Artisan::call('db:seed');
|
||||||
|
Artisan::call('module:seed', ['Karyawaf']);
|
||||||
|
Artisan::call('passport:client', ['--password' => true, '--name' => 'laraland']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _before(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$this->initDatabase();
|
||||||
|
|
||||||
|
Passport::actingAs(Admin::find(1));
|
||||||
|
|
||||||
|
$I->seeAuthentication('api');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function _after(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAllData(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::find(1);
|
||||||
|
|
||||||
|
$I->sendGET($this->endpoint);
|
||||||
|
|
||||||
|
$I->seeResponseContainsJson([
|
||||||
|
'data' => [
|
||||||
|
['nama' => $karyawan->nama]
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSingleData(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::find(1);
|
||||||
|
|
||||||
|
$I->sendGET($this->endpoint . '/' . $karyawan->id);
|
||||||
|
|
||||||
|
$I->seeResponseContainsJson([
|
||||||
|
'data' => [
|
||||||
|
'nama' => $karyawan->nama
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeData(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
Auth::user()->givePermissionTo('create-karyawan');
|
||||||
|
|
||||||
|
$faker = Faker\Factory::create();
|
||||||
|
$karyawan = [
|
||||||
|
'nama' => $faker->name,
|
||||||
|
'posisi' => $faker->jobTitle,
|
||||||
|
'tempat_lahir' => $faker->city,
|
||||||
|
'tanggal_lahir' => $faker->dateTimeBetween('-50 years', '-19 years', 'Asia/Jakarta')->format('Y-m-d'),
|
||||||
|
'rekrut' => $faker->dateTimeBetween('-10 years', '-1 year', 'Asia/Jakarta')->format('Y-m-d'),
|
||||||
|
'status' => 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
// $I->haveHttpHeader('Content-Type', 'multipart/form-data');
|
||||||
|
$I->sendPOST($this->endpoint, $karyawan);
|
||||||
|
|
||||||
|
$I->seeResponseContainsJson([
|
||||||
|
'data' => [
|
||||||
|
'nama' => $karyawan['nama']
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateData(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
Auth::user()->givePermissionTo('update-karyawan');
|
||||||
|
|
||||||
|
$karyawan = Karyawan::find(1);
|
||||||
|
|
||||||
|
$I->sendPUT($this->endpoint . '/' . $karyawan->id, [
|
||||||
|
'nama' => 'Gregorio',
|
||||||
|
'posisi' => $karyawan->posisi,
|
||||||
|
'tempat_lahir' => $karyawan->tempat_lahir,
|
||||||
|
'tanggal_lahir' => $karyawan->tanggal_lahir,
|
||||||
|
'rekrut' => $karyawan->rekrut,
|
||||||
|
'status' => $karyawan->status
|
||||||
|
]);
|
||||||
|
|
||||||
|
$I->seeResponseContainsJson([
|
||||||
|
'data' => [
|
||||||
|
'nama' => 'Gregorio'
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteData(FunctionalTester $I)
|
||||||
|
{
|
||||||
|
$karyawan = Karyawan::find(1);
|
||||||
|
|
||||||
|
$I->sendDELETE($this->endpoint . '/' . $karyawan->id);
|
||||||
|
|
||||||
|
$I->seeResponseCodeIsSuccessful();
|
||||||
|
$I->seeResponseContains('deleted');
|
||||||
|
}
|
||||||
|
}
|
9
Modules/Karyawaf/Tests/unit.suite.yml
Normal file
9
Modules/Karyawaf/Tests/unit.suite.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Codeception Test Suite Configuration
|
||||||
|
#
|
||||||
|
# Suite for unit or integration tests.
|
||||||
|
|
||||||
|
actor: UnitTester
|
||||||
|
modules:
|
||||||
|
enabled:
|
||||||
|
- Asserts
|
||||||
|
- \Helper\Unit
|
10
Modules/Karyawaf/codeception.yml
Normal file
10
Modules/Karyawaf/codeception.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
paths:
|
||||||
|
tests: Tests
|
||||||
|
output: Tests/_output
|
||||||
|
data: Tests/_data
|
||||||
|
support: Tests/_support
|
||||||
|
envs: Tests/_envs
|
||||||
|
actor_suffix: Tester
|
||||||
|
extensions:
|
||||||
|
enabled:
|
||||||
|
- Codeception\Extension\RunFailed
|
25
Modules/Karyawaf/composer.json
Normal file
25
Modules/Karyawaf/composer.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"name": "nwidart/karyawaf",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Widart",
|
||||||
|
"email": "n.widart@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Karyawaf\\Providers\\KaryawafServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\Karyawaf\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
Modules/Karyawaf/module.json
Normal file
16
Modules/Karyawaf/module.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "Karyawaf",
|
||||||
|
"alias": "karyawaf",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"active": 1,
|
||||||
|
"order": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Karyawaf\\Providers\\KaryawafServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [
|
||||||
|
"start.php"
|
||||||
|
],
|
||||||
|
"requires": []
|
||||||
|
}
|
17
Modules/Karyawaf/package.json
Normal file
17
Modules/Karyawaf/package.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "npm run development",
|
||||||
|
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"watch-poll": "npm run watch -- --watch-poll",
|
||||||
|
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
|
||||||
|
"prod": "npm run production",
|
||||||
|
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"cross-env": "^5.1.4",
|
||||||
|
"laravel-mix": "^2.1",
|
||||||
|
"laravel-mix-merge-manifest": "^0.1.1"
|
||||||
|
}
|
||||||
|
}
|
16
Modules/Karyawaf/start.php
Normal file
16
Modules/Karyawaf/start.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register Namespaces and Routes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When your module starts, this file is executed automatically. By default
|
||||||
|
| it will only load the module's route file. However, you can expand on
|
||||||
|
| it to load anything else from the module, such as a class or view.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!app()->routesAreCached()) {
|
||||||
|
require __DIR__ . '/Http/routes.php';
|
||||||
|
}
|
11
Modules/Karyawaf/webpack.mix.js
vendored
Normal file
11
Modules/Karyawaf/webpack.mix.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
const { mix } = require('laravel-mix');
|
||||||
|
require('laravel-mix-merge-manifest');
|
||||||
|
|
||||||
|
mix.setPublicPath('../../public').mergeManifest();
|
||||||
|
|
||||||
|
mix.js(__dirname + '/Resources/assets/js/app.js', 'js/karyawaf.js')
|
||||||
|
.sass( __dirname + '/Resources/assets/sass/app.scss', 'css/karyawaf.css');
|
||||||
|
|
||||||
|
if (mix.inProduction()) {
|
||||||
|
mix.version();
|
||||||
|
}
|
29
RoboFile.php
Normal file
29
RoboFile.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This is project's console commands configuration for Robo task runner.
|
||||||
|
*
|
||||||
|
* @see http://robo.li/
|
||||||
|
*/
|
||||||
|
class RoboFile extends \Robo\Tasks
|
||||||
|
{
|
||||||
|
public function testServer()
|
||||||
|
{
|
||||||
|
$this->taskSshExec('192.168.1.17', 'root')
|
||||||
|
|
||||||
|
# change the directory
|
||||||
|
->remoteDir('/var/www/laraland')
|
||||||
|
|
||||||
|
# update the repository
|
||||||
|
->exec('git pull origin develop')
|
||||||
|
->exec('git checkout origin/develop')
|
||||||
|
|
||||||
|
# install dependencies
|
||||||
|
->exec('composer install')
|
||||||
|
|
||||||
|
# run test
|
||||||
|
->exec('vendor/bin/codecept run acceptance --env staging')
|
||||||
|
|
||||||
|
# execute above commands
|
||||||
|
->run();
|
||||||
|
}
|
||||||
|
}
|
8
app/Admin.php
Normal file
8
app/Admin.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
class Admin extends User
|
||||||
|
{
|
||||||
|
protected $guard_name = 'api';
|
||||||
|
}
|
28
app/Http/Controllers/HomeController.php
Normal file
28
app/Http/Controllers/HomeController.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class HomeController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the application dashboard.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return view('home');
|
||||||
|
}
|
||||||
|
}
|
89
app/Http/Controllers/PermissionController.php
Normal file
89
app/Http/Controllers/PermissionController.php
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\User;
|
||||||
|
use App\Permission;
|
||||||
|
use App\Http\Requests\StorePermission;
|
||||||
|
use App\Http\Requests\UpdatePermission;
|
||||||
|
|
||||||
|
class PermissionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$response = Permission::all();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage
|
||||||
|
* @param StorePermission $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store(StorePermission $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$response = Permission::create($validated);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource
|
||||||
|
* @param int $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$response = Permission::findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage
|
||||||
|
* @param UpdatePermission $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update(UpdatePermission $request, $id)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$permission = Permission::findOrFail($id);
|
||||||
|
|
||||||
|
$permission->update($validated);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $permission
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage
|
||||||
|
* @param int $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$permission = Permission::findOrFail($id);
|
||||||
|
|
||||||
|
$permission->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'The data has been deleted'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
88
app/Http/Controllers/RoleController.php
Normal file
88
app/Http/Controllers/RoleController.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Role;
|
||||||
|
use App\Http\Requests\StoreRole;
|
||||||
|
use App\Http\Requests\UpdateRole;
|
||||||
|
|
||||||
|
class RoleController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$response = Role::all();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store a newly created resource in storage
|
||||||
|
* @param StoreRole $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function store(StoreRole $request)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$response = Role::create($validated);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show the specified resource
|
||||||
|
* @param int $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function show($id)
|
||||||
|
{
|
||||||
|
$response = Role::findOrFail($id);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $response
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the specified resource in storage
|
||||||
|
* @param UpdateRole $request
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function update(UpdateRole $request, $id)
|
||||||
|
{
|
||||||
|
$validated = $request->validated();
|
||||||
|
|
||||||
|
$role = Role::findOrFail($id);
|
||||||
|
|
||||||
|
$role->update($validated);
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'data' => $role
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the specified resource from storage
|
||||||
|
* @param int $id
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$role = Role::findOrFail($id);
|
||||||
|
|
||||||
|
$role->delete();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'The data has been deleted'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
72
app/Http/Controllers/UserRolePermissionController.php
Normal file
72
app/Http/Controllers/UserRolePermissionController.php
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Permission;
|
||||||
|
use App\Role;
|
||||||
|
use App\Http\Resources\PermissionResource;
|
||||||
|
use App\Http\Resources\RoleResource;
|
||||||
|
|
||||||
|
class UserRolePermissionController extends Controller
|
||||||
|
{
|
||||||
|
public function permissionAttachRole($permission, $role)
|
||||||
|
{
|
||||||
|
$permission = Permission::findOrFail($permission);
|
||||||
|
$role = Role::findOrFail($role);
|
||||||
|
|
||||||
|
$permission->assignRole($role);
|
||||||
|
|
||||||
|
return new PermissionResource($permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function permissionAttachMultiRoles(Request $roles, $permission)
|
||||||
|
{
|
||||||
|
$permission = Permission::findOrFail($permission);
|
||||||
|
$roles = Role::whereIn('id', $roles)->get();
|
||||||
|
|
||||||
|
$permission->syncRoles($roles);
|
||||||
|
|
||||||
|
return new PermissionResource($permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function permissionRemoveRole($permission, $role)
|
||||||
|
{
|
||||||
|
$permission = Permission::findOrFail($permission);
|
||||||
|
$role = Role::findOrFail($role);
|
||||||
|
|
||||||
|
$permission->removeRole($role);
|
||||||
|
|
||||||
|
return new PermissionResource($permission);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function roleAttachPermission($role, $permission)
|
||||||
|
{
|
||||||
|
$role = Role::findOrFail($role);
|
||||||
|
$permission = Permission::findOrFail($permission);
|
||||||
|
|
||||||
|
$role->givePermissionTo($permission);
|
||||||
|
|
||||||
|
return new RoleResource($role);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function roleAttachMultiPermissions(Request $permissions, $role)
|
||||||
|
{
|
||||||
|
$role = Role::findOrFail($role);
|
||||||
|
$permissions = Permission::whereIn('id', $permissions)->get();
|
||||||
|
|
||||||
|
$role->syncPermissions($permissions);
|
||||||
|
|
||||||
|
return new RoleResource($role);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function roleRemovePermission($role, $permission)
|
||||||
|
{
|
||||||
|
$role = Role::findOrFail($role);
|
||||||
|
$permission = Permission::findOrFail($permission);
|
||||||
|
|
||||||
|
$role->revokePermissionTo($permission);
|
||||||
|
|
||||||
|
return new RoleResource($role);
|
||||||
|
}
|
||||||
|
}
|
30
app/Http/Requests/StorePermission.php
Normal file
30
app/Http/Requests/StorePermission.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use App\Permission;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class StorePermission extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('create-permission');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return Permission::getCreateRules();
|
||||||
|
}
|
||||||
|
}
|
30
app/Http/Requests/StoreRole.php
Normal file
30
app/Http/Requests/StoreRole.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Role;
|
||||||
|
|
||||||
|
class StoreRole extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('create-role');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
return Role::getCreateRules();
|
||||||
|
}
|
||||||
|
}
|
32
app/Http/Requests/UpdatePermission.php
Normal file
32
app/Http/Requests/UpdatePermission.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use App\Permission;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
|
||||||
|
class UpdatePermission extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('update-permission');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
$id = $this->permission;
|
||||||
|
|
||||||
|
return Permission::getUpdateRulesForId($id);
|
||||||
|
}
|
||||||
|
}
|
32
app/Http/Requests/UpdateRole.php
Normal file
32
app/Http/Requests/UpdateRole.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use App\Role;
|
||||||
|
|
||||||
|
class UpdateRole extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
return Auth::user()->can('update-role');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
$id = $this->role;
|
||||||
|
|
||||||
|
return Role::getUpdateRulesForId($id);
|
||||||
|
}
|
||||||
|
}
|
32
app/Http/Resources/PermissionResource.php
Normal file
32
app/Http/Resources/PermissionResource.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\Resource;
|
||||||
|
|
||||||
|
class PermissionResource extends Resource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => [
|
||||||
|
'id' => $this->id,
|
||||||
|
'name' => $this->name,
|
||||||
|
'guard_name' => $this->guard_name,
|
||||||
|
'created_at' => $this->created_at->toIso8601String(),
|
||||||
|
'updated_at' => $this->updated_at->toIso8601String(),
|
||||||
|
'deleted_at' => $this->deleted_at
|
||||||
|
? $this->deleted_at->toIso8601String()
|
||||||
|
: $this->deleted_at,
|
||||||
|
'roles' => $this->roles,
|
||||||
|
'users' => $this->users,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
32
app/Http/Resources/RoleResource.php
Normal file
32
app/Http/Resources/RoleResource.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Resources;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\Resource;
|
||||||
|
|
||||||
|
class RoleResource extends Resource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'data' => [
|
||||||
|
'id' => $this->id,
|
||||||
|
'name' => $this->name,
|
||||||
|
'guard_name' => $this->guard_name,
|
||||||
|
'created_at' => $this->created_at->toIso8601String(),
|
||||||
|
'updated_at' => $this->updated_at->toIso8601String(),
|
||||||
|
'deleted_at' => $this->deleted_at
|
||||||
|
? $this->deleted_at->toIso8601String()
|
||||||
|
: $this->deleted_at,
|
||||||
|
'permissions' => $this->permissions,
|
||||||
|
'users' => $this->users
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
app/Permission.php
Normal file
28
app/Permission.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Spatie\Permission\Models\Permission as PermissionParent;
|
||||||
|
use Sofa\Eloquence\Eloquence;
|
||||||
|
use Sofa\Eloquence\Validable;
|
||||||
|
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||||
|
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||||
|
|
||||||
|
class Permission extends PermissionParent implements ValidableContract, CleansAttributes
|
||||||
|
{
|
||||||
|
use SoftDeletes, Eloquence, Validable;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name', 'guard_name',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'created_at', 'updated_at', 'deleted_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static $businessRules = [
|
||||||
|
'name' => 'required|string|min:3',
|
||||||
|
'guard_name' => 'string|min:3'
|
||||||
|
];
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -13,7 +14,7 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
//
|
Schema::defaultStringLength(191);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Laravel\Passport\Passport;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
@ -25,6 +26,6 @@ class AuthServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$this->registerPolicies();
|
$this->registerPolicies();
|
||||||
|
|
||||||
//
|
Passport::routes();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
app/Role.php
Normal file
28
app/Role.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
use Spatie\Permission\Models\Role as RoleParent;
|
||||||
|
use Sofa\Eloquence\Eloquence;
|
||||||
|
use Sofa\Eloquence\Validable;
|
||||||
|
use Sofa\Eloquence\Contracts\CleansAttributes;
|
||||||
|
use Sofa\Eloquence\Contracts\Validable as ValidableContract;
|
||||||
|
|
||||||
|
class Role extends RoleParent implements ValidableContract, CleansAttributes
|
||||||
|
{
|
||||||
|
use SoftDeletes, Eloquence, Validable;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'name', 'guard_name',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $dates = [
|
||||||
|
'created_at', 'updated_at', 'deleted_at',
|
||||||
|
];
|
||||||
|
|
||||||
|
protected static $businessRules = [
|
||||||
|
'name' => 'required|string|min:3',
|
||||||
|
'guard_name' => 'string|min:3'
|
||||||
|
];
|
||||||
|
}
|
16
app/User.php
16
app/User.php
@ -2,12 +2,21 @@
|
|||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use Laravel\Passport\HasApiTokens;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Spatie\Permission\Traits\HasRoles;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable;
|
use Notifiable, HasApiTokens, HasRoles;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the base table name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'users';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
@ -26,4 +35,9 @@ class User extends Authenticatable
|
|||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
'password', 'remember_token',
|
'password', 'remember_token',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function karyawans()
|
||||||
|
{
|
||||||
|
return $this->hasMany(\Modules\Karyawaf\Entities\Karyawan::class, 'created_by');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
12
codeception.yml
Normal file
12
codeception.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
paths:
|
||||||
|
tests: tests
|
||||||
|
output: tests/_output
|
||||||
|
data: tests/_data
|
||||||
|
support: tests/_support
|
||||||
|
envs: tests/_envs
|
||||||
|
actor_suffix: Tester
|
||||||
|
extensions:
|
||||||
|
enabled:
|
||||||
|
- Codeception\Extension\RunFailed
|
||||||
|
settings:
|
||||||
|
bootstrap: _bootstrap.php
|
@ -7,19 +7,23 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.0.0",
|
"php": ">=7.0.0",
|
||||||
"barryvdh/laravel-snappy": "^0.4.1",
|
"barryvdh/laravel-snappy": "^0.4.1",
|
||||||
|
"consolidation/robo": "~1",
|
||||||
"fideloper/proxy": "~3.3",
|
"fideloper/proxy": "~3.3",
|
||||||
"flugger/laravel-responder": "^3.0",
|
"flugger/laravel-responder": "^3.0",
|
||||||
"laravel/framework": "5.5.*",
|
"laravel/framework": "5.5.*",
|
||||||
|
"laravel/passport": "~4.0",
|
||||||
"laravel/tinker": "~1.0",
|
"laravel/tinker": "~1.0",
|
||||||
"nwidart/laravel-modules": "^3.3",
|
"nwidart/laravel-modules": "^3.3",
|
||||||
"owen-it/laravel-auditing": "^7.0",
|
"owen-it/laravel-auditing": "^7.0",
|
||||||
"sofa/eloquence": "^5.6",
|
"sofa/eloquence": "^5.6",
|
||||||
"spatie/laravel-permission": "^2.12"
|
"spatie/laravel-permission": "^2.12",
|
||||||
|
"watson/validating": "^3.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"codeception/codeception": "^2.4",
|
"codeception/codeception": "^2.4",
|
||||||
"filp/whoops": "~2.0",
|
"filp/whoops": "~2.0",
|
||||||
"fzaninotto/faker": "~1.4",
|
"fzaninotto/faker": "~1.4",
|
||||||
|
"guzzlehttp/guzzle": "^6.3",
|
||||||
"mockery/mockery": "~1.0",
|
"mockery/mockery": "~1.0",
|
||||||
"phpunit/phpunit": "~6.0",
|
"phpunit/phpunit": "~6.0",
|
||||||
"symfony/thanks": "^1.0"
|
"symfony/thanks": "^1.0"
|
||||||
@ -30,7 +34,8 @@
|
|||||||
"database/factories"
|
"database/factories"
|
||||||
],
|
],
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"App\\": "app/"
|
"App\\": "app/",
|
||||||
|
"Modules\\": "Modules/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
|
1811
composer.lock
generated
1811
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'url' => env('APP_URL', 'http://localhost'),
|
'url' => env('APP_URL', 'http://laraland.test'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -167,6 +167,9 @@ return [
|
|||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
*/
|
*/
|
||||||
|
Spatie\Permission\PermissionServiceProvider::class,
|
||||||
|
Nwidart\Modules\LaravelModulesServiceProvider::class,
|
||||||
|
Flugg\Responder\ResponderServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
@ -225,6 +228,8 @@ return [
|
|||||||
'URL' => Illuminate\Support\Facades\URL::class,
|
'URL' => Illuminate\Support\Facades\URL::class,
|
||||||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||||
'View' => Illuminate\Support\Facades\View::class,
|
'View' => Illuminate\Support\Facades\View::class,
|
||||||
|
'Responder' => Flugg\Responder\Facades\Responder::class,
|
||||||
|
'Transformation' => Flugg\Responder\Facades\Transformation::class,
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'api' => [
|
'api' => [
|
||||||
'driver' => 'token',
|
'driver' => 'passport',
|
||||||
'provider' => 'users',
|
'provider' => 'users',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
32
config/laravel
Normal file
32
config/laravel
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
server {
|
||||||
|
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
|
||||||
|
server_name laraland.test;
|
||||||
|
root /var/www/laraland/public;
|
||||||
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
try_files $uri /index.php =404;
|
||||||
|
fastcgi_pass php-upstream;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_buffers 16 16k;
|
||||||
|
fastcgi_buffer_size 32k;
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
include fastcgi_params;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /.well-known/acme-challenge/ {
|
||||||
|
root /var/www/letsencrypt/;
|
||||||
|
log_not_found off;
|
||||||
|
}
|
||||||
|
}
|
189
config/modules.php
Normal file
189
config/modules.php
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Module Namespace
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Default module namespace.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'namespace' => 'Modules',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Module Stubs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Default module stubs.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stubs' => [
|
||||||
|
'enabled' => false,
|
||||||
|
'path' => base_path() . '/vendor/nwidart/laravel-modules/src/Commands/stubs',
|
||||||
|
'files' => [
|
||||||
|
'start' => 'start.php',
|
||||||
|
'routes' => 'Http/routes.php',
|
||||||
|
'views/index' => 'Resources/views/index.blade.php',
|
||||||
|
'views/master' => 'Resources/views/layouts/master.blade.php',
|
||||||
|
'scaffold/config' => 'Config/config.php',
|
||||||
|
'composer' => 'composer.json',
|
||||||
|
'assets/js/app' => 'Resources/assets/js/app.js',
|
||||||
|
'assets/sass/app' => 'Resources/assets/sass/app.scss',
|
||||||
|
'webpack' => 'webpack.mix.js',
|
||||||
|
'package' => 'package.json',
|
||||||
|
],
|
||||||
|
'replacements' => [
|
||||||
|
'start' => ['LOWER_NAME', 'ROUTES_LOCATION'],
|
||||||
|
'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||||
|
'webpack' => ['LOWER_NAME'],
|
||||||
|
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||||
|
'views/index' => ['LOWER_NAME'],
|
||||||
|
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||||
|
'scaffold/config' => ['STUDLY_NAME'],
|
||||||
|
'composer' => [
|
||||||
|
'LOWER_NAME',
|
||||||
|
'STUDLY_NAME',
|
||||||
|
'VENDOR',
|
||||||
|
'AUTHOR_NAME',
|
||||||
|
'AUTHOR_EMAIL',
|
||||||
|
'MODULE_NAMESPACE',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'gitkeep' => true,
|
||||||
|
],
|
||||||
|
'paths' => [
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Modules path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This path used for save the generated module. This path also will be added
|
||||||
|
| automatically to list of scanned folders.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'modules' => base_path('Modules'),
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Modules assets path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may update the modules assets path.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'assets' => public_path('modules'),
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| The migrations path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Where you run 'module:publish-migration' command, where do you publish the
|
||||||
|
| the migration files?
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'migration' => base_path('database/migrations'),
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Generator path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Customise the paths where the folders will be generated.
|
||||||
|
| Set the generate key to false to not generate that folder
|
||||||
|
*/
|
||||||
|
'generator' => [
|
||||||
|
'config' => ['path' => 'Config', 'generate' => true],
|
||||||
|
'command' => ['path' => 'Console', 'generate' => true],
|
||||||
|
'migration' => ['path' => 'Database/Migrations', 'generate' => true],
|
||||||
|
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
|
||||||
|
'factory' => ['path' => 'Database/factories', 'generate' => true],
|
||||||
|
'model' => ['path' => 'Entities', 'generate' => true],
|
||||||
|
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
||||||
|
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
|
||||||
|
'request' => ['path' => 'Http/Requests', 'generate' => true],
|
||||||
|
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||||
|
'assets' => ['path' => 'Resources/assets', 'generate' => true],
|
||||||
|
'lang' => ['path' => 'Resources/lang', 'generate' => true],
|
||||||
|
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||||
|
'test' => ['path' => 'Tests', 'generate' => true],
|
||||||
|
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||||
|
'event' => ['path' => 'Events', 'generate' => false],
|
||||||
|
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||||
|
'policies' => ['path' => 'Policies', 'generate' => false],
|
||||||
|
'rules' => ['path' => 'Rules', 'generate' => false],
|
||||||
|
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
||||||
|
'emails' => ['path' => 'Emails', 'generate' => false],
|
||||||
|
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
||||||
|
'resource' => ['path' => 'Transformers', 'generate' => false],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Scan Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you define which folder will be scanned. By default will scan vendor
|
||||||
|
| directory. This is useful if you host the package in packagist website.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'scan' => [
|
||||||
|
'enabled' => false,
|
||||||
|
'paths' => [
|
||||||
|
base_path('vendor/*/*'),
|
||||||
|
// base_path('Modules/*'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Composer File Template
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is the config for composer.json file, generated by this package
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'composer' => [
|
||||||
|
'vendor' => 'nwidart',
|
||||||
|
'author' => [
|
||||||
|
'name' => 'Nicolas Widart',
|
||||||
|
'email' => 'n.widart@gmail.com',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Caching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here is the config for setting up caching feature.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'cache' => [
|
||||||
|
'enabled' => false,
|
||||||
|
'key' => 'laravel-modules',
|
||||||
|
'lifetime' => 60,
|
||||||
|
],
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Choose what laravel-modules will register as custom namespaces.
|
||||||
|
| Setting one to false will require you to register that part
|
||||||
|
| in your own Service Provider class.
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
'register' => [
|
||||||
|
'translations' => true,
|
||||||
|
/**
|
||||||
|
* load files on boot or register method
|
||||||
|
*
|
||||||
|
* Note: boot not compatible with asgardcms
|
||||||
|
*
|
||||||
|
* @example boot|register
|
||||||
|
*/
|
||||||
|
'files' => 'register',
|
||||||
|
],
|
||||||
|
];
|
4
config/nginx-start.sh
Normal file
4
config/nginx-start.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cp /opt/etc/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
sed -i "s/%fpm-ip%/$FPM_PORT_9000_TCP_ADDR/" /etc/nginx/nginx.conf
|
||||||
|
exec /usr/sbin/nginx
|
34
config/nginx.conf
Normal file
34
config/nginx.conf
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
user www-data;
|
||||||
|
worker_processes 4;
|
||||||
|
pid /run/nginx.pid;
|
||||||
|
daemon off;
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 2048;
|
||||||
|
multi_accept on;
|
||||||
|
use epoll;
|
||||||
|
}
|
||||||
|
|
||||||
|
http {
|
||||||
|
server_tokens off;
|
||||||
|
sendfile on;
|
||||||
|
tcp_nopush on;
|
||||||
|
tcp_nodelay on;
|
||||||
|
keepalive_timeout 15;
|
||||||
|
types_hash_max_size 2048;
|
||||||
|
client_max_body_size 20M;
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
access_log /dev/stdout;
|
||||||
|
error_log /dev/stderr;
|
||||||
|
gzip on;
|
||||||
|
gzip_disable "msie6";
|
||||||
|
|
||||||
|
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||||
|
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
|
||||||
|
|
||||||
|
include /etc/nginx/conf.d/*.conf;
|
||||||
|
include /etc/nginx/sites-available/*.conf;
|
||||||
|
open_file_cache off; # Disabled for issue 619
|
||||||
|
charset UTF-8;
|
||||||
|
}
|
88
config/permission.php
Normal file
88
config/permission.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'models' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||||
|
* is often just the "Permission" model but you may use whatever you like.
|
||||||
|
*
|
||||||
|
* The model you want to use as a Permission model needs to implement the
|
||||||
|
* `Spatie\Permission\Contracts\Permission` contract.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'permission' => Spatie\Permission\Models\Permission::class,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||||
|
* is often just the "Role" model but you may use whatever you like.
|
||||||
|
*
|
||||||
|
* The model you want to use as a Role model needs to implement the
|
||||||
|
* `Spatie\Permission\Contracts\Role` contract.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'role' => Spatie\Permission\Models\Role::class,
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'table_names' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* table should be used to retrieve your roles. We have chosen a basic
|
||||||
|
* default value but you may easily change it to any table you like.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'roles' => 'roles',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* table should be used to retrieve your permissions. We have chosen a basic
|
||||||
|
* default value but you may easily change it to any table you like.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'permissions' => 'permissions',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* table should be used to retrieve your models permissions. We have chosen a
|
||||||
|
* basic default value but you may easily change it to any table you like.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'model_has_permissions' => 'model_has_permissions',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* table should be used to retrieve your models roles. We have chosen a
|
||||||
|
* basic default value but you may easily change it to any table you like.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'model_has_roles' => 'model_has_roles',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When using the "HasRoles" trait from this package, we need to know which
|
||||||
|
* table should be used to retrieve your roles permissions. We have chosen a
|
||||||
|
* basic default value but you may easily change it to any table you like.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'role_has_permissions' => 'role_has_permissions',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* By default all permissions will be cached for 24 hours unless a permission or
|
||||||
|
* role is updated. Then the cache will be flushed immediately.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cache_expiration_time' => 60 * 24,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When set to true, the required permission/role names are added to the exception
|
||||||
|
* message. This could be considered an information leak in some contexts, so
|
||||||
|
* the default setting is false here for optimum safety.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'display_permission_in_exception' => false,
|
||||||
|
];
|
102
config/responder.php
Normal file
102
config/responder.php
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Serializer Class Paths
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The full class path to the serializer classes you want to use for both
|
||||||
|
| success- and error responses. The success serializer must implement
|
||||||
|
| Fractal's serializer. You can override these for every response.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'serializers' => [
|
||||||
|
'success' => Flugg\Responder\Serializers\SuccessSerializer::class,
|
||||||
|
'error' => \Flugg\Responder\Serializers\ErrorSerializer::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Response Decorators
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Response decorators are used to decorate both your success- and error
|
||||||
|
| responses. A decorator can be disabled by removing it from the list
|
||||||
|
| below. You may additionally add your own decorators to the list.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'decorators' => [
|
||||||
|
\Flugg\Responder\Http\Responses\Decorators\StatusCodeDecorator::class,
|
||||||
|
\Flugg\Responder\Http\Responses\Decorators\SuccessFlagDecorator::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Fallback Transformer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When transforming data without specifying a transformer we'll instead
|
||||||
|
| use a fallback transformer specified below. The [ArrayTransformer]
|
||||||
|
| transformer will simply convert the data to an array untouched.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'fallback_transformer' => \Flugg\Responder\Transformers\ArrayTransformer::class,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Load Relationships With Query String Parameter
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The package can automatically load relationships from the query string
|
||||||
|
| and will look for a query string parameter with the name configured
|
||||||
|
| below. You can set the value to null to disable the autoloading.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'load_relations_parameter' => 'with',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filter Fields With Query String Parameter
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The package can automatically filter the fields of transformed data
|
||||||
|
| from a query string parameter configured below. The technique is
|
||||||
|
| also known as sparse fieldsets. Set it to null to disable it.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'filter_fields_parameter' => 'only',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Recursion Limit
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When transforming data, you may be including relations recursively.
|
||||||
|
| By setting the value below, you can limit the amount of times it
|
||||||
|
| should include relationships recursively. Five might be good.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'recursion_limit' => 5,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Error Message Translation Files
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You can declare error messages in a language file, which allows for
|
||||||
|
| returning messages in different languages. The array below lists
|
||||||
|
| the language files that will be searched in to find messages.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'error_message_files' => ['errors'],
|
||||||
|
|
||||||
|
];
|
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreatePermissionTables extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$tableNames = config('permission.table_names');
|
||||||
|
|
||||||
|
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('guard_name');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create($tableNames['roles'], function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->string('name');
|
||||||
|
$table->string('guard_name');
|
||||||
|
$table->timestamps();
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||||
|
$table->unsignedInteger('permission_id');
|
||||||
|
$table->morphs('model');
|
||||||
|
|
||||||
|
$table->foreign('permission_id')
|
||||||
|
->references('id')
|
||||||
|
->on($tableNames['permissions'])
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['permission_id', 'model_id', 'model_type'], 'model_has_permissions_permission_model_type_primary');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames) {
|
||||||
|
$table->unsignedInteger('role_id');
|
||||||
|
$table->morphs('model');
|
||||||
|
|
||||||
|
$table->foreign('role_id')
|
||||||
|
->references('id')
|
||||||
|
->on($tableNames['roles'])
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['role_id', 'model_id', 'model_type']);
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||||
|
$table->unsignedInteger('permission_id');
|
||||||
|
$table->unsignedInteger('role_id');
|
||||||
|
|
||||||
|
$table->foreign('permission_id')
|
||||||
|
->references('id')
|
||||||
|
->on($tableNames['permissions'])
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->foreign('role_id')
|
||||||
|
->references('id')
|
||||||
|
->on($tableNames['roles'])
|
||||||
|
->onDelete('cascade');
|
||||||
|
|
||||||
|
$table->primary(['permission_id', 'role_id']);
|
||||||
|
|
||||||
|
app('cache')->forget('spatie.permission.cache');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$tableNames = config('permission.table_names');
|
||||||
|
|
||||||
|
Schema::drop($tableNames['role_has_permissions']);
|
||||||
|
Schema::drop($tableNames['model_has_roles']);
|
||||||
|
Schema::drop($tableNames['model_has_permissions']);
|
||||||
|
Schema::drop($tableNames['roles']);
|
||||||
|
Schema::drop($tableNames['permissions']);
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@ class DatabaseSeeder extends Seeder
|
|||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
// $this->call(UsersTableSeeder::class);
|
$this->call(UsersTableSeeder::class);
|
||||||
|
$this->call(PermissionsTableSeeder::class);
|
||||||
|
$this->call(RolesTableSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
35
database/seeds/PermissionsTableSeeder.php
Normal file
35
database/seeds/PermissionsTableSeeder.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Spatie\Permission\Models\Permission;
|
||||||
|
|
||||||
|
class PermissionsTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Permission::create(['name' => 'create-karyawan', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'read-karyawan', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'update-karyawan', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'delete-karyawan', 'guard_name' => 'api']);
|
||||||
|
|
||||||
|
Permission::create(['name' => 'create-user', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'read-user', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'update-user', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'delete-user', 'guard_name' => 'api']);
|
||||||
|
|
||||||
|
Permission::create(['name' => 'create-permission', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'read-permission', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'update-permission', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'delete-permission', 'guard_name' => 'api']);
|
||||||
|
|
||||||
|
Permission::create(['name' => 'create-role', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'read-role', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'update-role', 'guard_name' => 'api']);
|
||||||
|
Permission::create(['name' => 'delete-role', 'guard_name' => 'api']);
|
||||||
|
}
|
||||||
|
}
|
21
database/seeds/RolesTableSeeder.php
Normal file
21
database/seeds/RolesTableSeeder.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Spatie\Permission\Models\Role;
|
||||||
|
|
||||||
|
class RolesTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Role::create(['name' => 'staff', 'guard_name' => 'api']);
|
||||||
|
Role::create(['name' => 'supervisor', 'guard_name' => 'api']);
|
||||||
|
Role::create(['name' => 'manajer', 'guard_name' => 'api']);
|
||||||
|
Role::create(['name' => 'hrd', 'guard_name' => 'api']);
|
||||||
|
Role::create(['name' => 'chairwoman', 'guard_name' => 'api']);
|
||||||
|
}
|
||||||
|
}
|
18
database/seeds/UsersTableSeeder.php
Normal file
18
database/seeds/UsersTableSeeder.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class UsersTableSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
factory(App\User::class)->create([
|
||||||
|
'email' => 'admin@laraland.test'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
22
resources/lang/en/errors.php
Normal file
22
resources/lang/en/errors.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Error Message Language Lines
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following language lines are used by the Laravel Responder package.
|
||||||
|
| When it generates error responses, it will search the messages array
|
||||||
|
| below for any key matching the given error code for the response.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'unauthenticated' => 'You are not authenticated for this request.',
|
||||||
|
'unauthorized' => 'You are not authorized for this request.',
|
||||||
|
'page_not_found' => 'The requested page does not exist.',
|
||||||
|
'relation_not_found' => 'The requested relation does not exist.',
|
||||||
|
'validation_failed' => 'The given data failed to pass validation.',
|
||||||
|
|
||||||
|
];
|
69
resources/views/auth/login.blade.php
Normal file
69
resources/views/auth/login.blade.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Login</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" method="POST" action="{{ route('login') }}">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
|
||||||
|
|
||||||
|
@if ($errors->has('email'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('email') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
|
||||||
|
<label for="password" class="col-md-4 control-label">Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required>
|
||||||
|
|
||||||
|
@if ($errors->has('password'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('password') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-8 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Login
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<a class="btn btn-link" href="{{ route('password.request') }}">
|
||||||
|
Forgot Your Password?
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
47
resources/views/auth/passwords/email.blade.php
Normal file
47
resources/views/auth/passwords/email.blade.php
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Reset Password</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
@if (session('status'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<form class="form-horizontal" method="POST" action="{{ route('password.email') }}">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
|
||||||
|
|
||||||
|
@if ($errors->has('email'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('email') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Send Password Reset Link
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
70
resources/views/auth/passwords/reset.blade.php
Normal file
70
resources/views/auth/passwords/reset.blade.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Reset Password</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<input type="hidden" name="token" value="{{ $token }}">
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
|
||||||
|
|
||||||
|
@if ($errors->has('email'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('email') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
|
||||||
|
<label for="password" class="col-md-4 control-label">Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required>
|
||||||
|
|
||||||
|
@if ($errors->has('password'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('password') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
|
||||||
|
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
|
||||||
|
|
||||||
|
@if ($errors->has('password_confirmation'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('password_confirmation') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Reset Password
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
77
resources/views/auth/register.blade.php
Normal file
77
resources/views/auth/register.blade.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Register</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<form class="form-horizontal" method="POST" action="{{ route('register') }}">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
|
||||||
|
<label for="name" class="col-md-4 control-label">Name</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>
|
||||||
|
|
||||||
|
@if ($errors->has('name'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('name') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
|
||||||
|
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
|
||||||
|
|
||||||
|
@if ($errors->has('email'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('email') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
|
||||||
|
<label for="password" class="col-md-4 control-label">Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password" type="password" class="form-control" name="password" required>
|
||||||
|
|
||||||
|
@if ($errors->has('password'))
|
||||||
|
<span class="help-block">
|
||||||
|
<strong>{{ $errors->first('password') }}</strong>
|
||||||
|
</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-6 col-md-offset-4">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Register
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
23
resources/views/home.blade.php
Normal file
23
resources/views/home.blade.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8 col-md-offset-2">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">Dashboard</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
@if (session('status'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
You are logged in!
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
80
resources/views/layouts/app.blade.php
Normal file
80
resources/views/layouts/app.blade.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{ app()->getLocale() }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
|
<!-- CSRF Token -->
|
||||||
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||||
|
|
||||||
|
<title>{{ config('app.name', 'Laravel') }}</title>
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
|
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<nav class="navbar navbar-default navbar-static-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
|
||||||
|
<!-- Collapsed Hamburger -->
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle Navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Branding Image -->
|
||||||
|
<a class="navbar-brand" href="{{ url('/') }}">
|
||||||
|
{{ config('app.name', 'Laravel') }}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="app-navbar-collapse">
|
||||||
|
<!-- Left Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Right Side Of Navbar -->
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<!-- Authentication Links -->
|
||||||
|
@guest
|
||||||
|
<li><a href="{{ route('login') }}">Login</a></li>
|
||||||
|
<li><a href="{{ route('register') }}">Register</a></li>
|
||||||
|
@else
|
||||||
|
<li class="dropdown">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true" v-pre>
|
||||||
|
{{ Auth::user()->name }} <span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<a href="{{ route('logout') }}"
|
||||||
|
onclick="event.preventDefault();
|
||||||
|
document.getElementById('logout-form').submit();">
|
||||||
|
Logout
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
</form>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
@endguest
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
@yield('content')
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Scripts -->
|
||||||
|
<script src="{{ asset('js/app.js') }}"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user