Материал: Автоматизация учета аренды площадей клиентами компании ООО "Грандтитул"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
112
{
Schema::create('operations',function(Blueprint$table){
$table->increments('id');
$table->string('title',100);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
publicfunctiondown()
{
Schema::dropIfExists('operations');
}
}
<?php
useIlluminate\Support\Facades\Schema;
useIlluminate\Database\Schema\Blueprint;
useIlluminate\Database\Migrations\Migration;
classCreateTableClientsextendsMigration
{
/**
* Run the migrations.
*
* @return void
*/
publicfunctionup()
{
Schema::create('clients',function(Blueprint$table){
$table->increments('id');
$table->string('l_name',100);
$table->string('f_name',100);
$table->string('m_name',100)->default("");
$table->integer('sex');
$table->string('address',100);
$table->string('phone',15);
$table->integer('fc');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
publicfunctiondown()
{
Schema::dropIfExists('clients');
}
}
<?php
useIlluminate\Support\Facades\Schema;
useIlluminate\Database\Schema\Blueprint;
useIlluminate\Database\Migrations\Migration;
classCreateTableBuildingextendsMigration
{
/**
* Run the migrations.
*
* @return void
113
*/
publicfunctionup()
{
Schema::create('buildings',function(Blueprint$table){
$table->increments('id');
$table->string("address",100);
$table->string("description",100);
$table->string("description2",100);
$table->integer("building_type_id")->unsigned();
$table->integer("operation_id")->unsigned();
$table->integer("client_id")->unsigned();
$table->double("sq");
$table->double("sq2");
$table->integer("count_room");
$table->double("price");
$table->integer("floor");
$table->integer("floor_all");
$table->timestamps();
$table->foreign('building_type_id')
->references('id')
->on('building_types')
->onUpdate('cascade')
->onDelete('no action');
$table->foreign('operation_id')
->references('id')
->on('operations')
->onUpdate('cascade')
->onDelete('no action');
$table->foreign('client_id')
->references('id')
->on('clients')
->onUpdate('cascade')
->onDelete('no action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
publicfunctiondown()
{
Schema::table('buildings',function(Blueprint$table){
$table->dropForeign('buildings_building_type_id_foreign');
$table->dropForeign('buildings_operation_id_foreign');
$table->dropForeign('buildings_client_id_foreign');
});
Schema::dropIfExists('buildings');
}
}
<?php
useIlluminate\Support\Facades\Schema;
useIlluminate\Database\Schema\Blueprint;
useIlluminate\Database\Migrations\Migration;
classCreateTableOrdersextendsMigration
{
/**
* Run the migrations.
*
* @return void
*/
publicfunctionup()
{
Schema::create('orders',function(Blueprint$table){
$table->increments('id');
114
$table->string('description',100);
$table->integer('operation_id')->unsigned();
$table->integer('order_status_id')->unsigned();
$table->integer('agent_id')->unsigned();
$table->integer('client_id')->unsigned();
$table->timestamps();
$table->foreign('operation_id')
->references('id')
->on('operations')
->onUpdate('cascade')
->onDelete('no action');
$table->foreign('order_status_id')
->references('id')
->on('order_statuses')
->onUpdate('cascade')
->onDelete('no action');
$table->foreign('agent_id')
->references('id')
->on('agents')
->onUpdate('cascade')
->onDelete('no action');
$table->foreign('client_id')
->references('id')
->on('clients')
->onUpdate('cascade')
->onDelete('no action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
publicfunctiondown()
{
Schema::table('orders',function(Blueprint$table){
$table->dropForeign('orders_order_status_id_foreign');
$table->dropForeign('orders_operation_id_foreign');
$table->dropForeign('orders_client_id_foreign');
$table->dropForeign('orders_agent_id_foreign');
});
Schema::dropIfExists('orders');
}
}
<?php
$app=newIlluminate\Foundation\Application(
realpath(__DIR__.'/../')
);
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
return$app;
115
window._=require('lodash');
window.Popper=require('popper.js').default;
try{
window.$=window.jQuery=require('jquery');
require('bootstrap');
}catch(e){}
window.axios=require('axios');
window.axios.defaults.headers.common['X-Requested-With']='XMLHttpRequest';
lettoken=document.head.querySelector('meta[name="csrf-token"]');
if(token){
window.axios.defaults.headers.common['X-CSRF-TOKEN']=token.content;
}else{
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-
token');
}
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
require('air-datepicker');
require('select2');
window.Vue=require('vue');
letVeeValidate=require('vee-validate');
window.VueValidateDictionaryRu=require('vee-validate/dist/locale/ru');
Vue.use(VeeValidate,{
locale:'ru',
dictionary:{
ru:{
messages:VueValidateDictionaryRu
}
}
});
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
//Vue.component('example-component', require('./components/ExampleComponent.vue'));
Vue.component('lister-component',require('./components/ListerComponent.vue'));
Vue.component('clients-list',require('./components/ClientsList.vue'));
Vue.component('clients-add',require('./components/ClientsAdd.vue'));
Vue.component('order-add',require('./components/OrderAdd.vue'));
Vue.component('order-list',require('./components/OrderList.vue'));
Vue.component('building-add',require('./components/BuildingAdd.vue'));
Vue.component('building-list',require('./components/BuildingList.vue'));
if($("#lister").length>0){
constlister=newVue({
el:'#lister',
data:{
listData:phpToVueData.listData,
model:phpToVueData.model,
name:phpToVueData.name
},
116
mounted(){
console.log('mounted');
}
});
}
if($("#clients").length>0){
constclients=newVue({
el:'#clients',
data:{
paginateData:{
current_page:1,
data:[],
first_page_url:"http://camobjects/cObjects/searcher?page=1",
from:null,
last_page:1,
last_page_url:"http://camobjects/cObjects/searcher?page=1",
next_page_url:null,
path:"http://camobjects/cObjects/searcher",
per_page:15,
prev_page_url:null,
to:null,
total:0
},
searchField:"",
createdAtField:"",
fcField:0,
searchCaption:"Укажите параметры поиска для зароса!",
searchCaptionClases:"alert alert-info",
finalCaption:"",
creating:false
},
computed:{
clientsBr:function(){
returnthis.paginateData.data;
},
},
watch:{
searchField:function(){
this.startSearch();
},
createdAtField:function(){
this.startSearch();
},
fcField:function(){
this.startSearch();
},
},
methods:{
startSearch:function(){
this.searchCaptionClases="alert alert-info";
this.searchCaption='Ожидаюокончанияввода';
this.getSearchResult();
},
createModel:function(){
this.creating=!this.creating;
},
cancelCreate:function(){
this.creating=false;
},
storeModel:function(model){
this.paginateData.data.unshift(model);
this.startAlert('Клиентдобавлен');
this.creating=false;
},
updateModel:function(model){
letfinalIndex=false;
Источник: https://baza.diplomsite.ru/previewfile/2357