Commit 8239ff01 by 杨树贤

后台询价页面

parent 5e48e8ed
......@@ -17,17 +17,32 @@ class InquiryController extends AdminController
*/
protected function grid()
{
return Grid::make(new Inquiry(), function (Grid $grid) {
return Grid::make(new Inquiry(['user']), function (Grid $grid) {
$grid->column('inquiry_id')->sortable();
$grid->column('sales_id');
$grid->column('user.email');
$grid->column('inquiry_sn');
$grid->column('status');
$grid->column('status')->using(admin_trans('inquiry.options.status'))->badge([
-1 => 'danger',
0 => 'primary',
1 => 'success'
]);
$grid->column('remark');
$grid->column('priority');
$grid->column('priority')->using(admin_trans('inquiry.options.priority'))->badge([
1 => 'primary',
2 => 'success',
3 => 'danger'
]);;
$grid->column('user_types');
$grid->column('processing_time');
$grid->column('create_time');
$grid->column('update_time');
$grid->column('processing_time')->display(function ($time) {
return $time ? date('Y-m-d H:i:s', $time) : '';
});
$grid->column('create_time')->display(function ($time) {
return date('Y-m-d H:i:s', $time);
});
$grid->column('update_time')->display(function ($time) {
return $time ? date('Y-m-d H:i:s', $time) : '';
});
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('inquiry_id');
......
......@@ -13,4 +13,5 @@ class Inquiry extends EloquentRepository
* @var string
*/
protected $eloquentClass = Model::class;
}
......@@ -2,6 +2,7 @@
namespace App\Models;
use App\Models\User;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;
......@@ -16,4 +17,9 @@ class Inquiry extends Model
public $timestamps = false;
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'id');
}
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class InquiryItems extends Model
{
//
public $timestamps = false;
}
<?php
namespace App;
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
......
......@@ -68,7 +68,7 @@ return [
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
'model' => App\Models\User::class,
],
// 'users' => [
......
......@@ -4,8 +4,17 @@
use Faker\Generator as Faker;
$factory->define(\App\Models\Inquiry::class, function (Faker $faker) {
return [
static $number = 1;
return [
'sales_id' => $faker->numberBetween(1000, 1200),
'inquiry_sn' => \Illuminate\Support\Str::random(10),
'status' => $faker->numberBetween(1, 2),
'user_types' => $faker->numberBetween(1, 2),
'remark' => \Illuminate\Support\Str::random(30),
'create_time' => time() + rand(1, 2000),
];
});
<?php
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\Models\Inquiry;
use Faker\Generator as Faker;
$factory->define(\App\Models\InquiryItems::class, function (Faker $faker) {
return [
'inquiry_id' => $faker->numberBetween(1, 50),
'goods_name' => $faker->name,
'brand_name' => $faker->name,
'inquiry_number' => $faker->numberBetween(10, 1000),
'remark' => \Illuminate\Support\Str::random(30),
];
});
......@@ -2,7 +2,7 @@
/** @var \Illuminate\Database\Eloquent\Factory $factory */
use App\User;
use App\Models\User;
use Faker\Generator as Faker;
use Illuminate\Support\Str;
......
......@@ -12,5 +12,7 @@ class DatabaseSeeder extends Seeder
public function run()
{
// $this->call(UserSeeder::class);
$this->call(InquirySeeder::class);
// $this->call(InquiryItemsSeeder::class);
}
}
<?php
use Illuminate\Database\Seeder;
class InquiryItemsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\Models\Inquiry::class, 50)->create()->each(function ($user) {
$user->insert(factory(\App\Models\Inquiry::class)->make());
});
}
}
......@@ -11,6 +11,8 @@ class InquirySeeder extends Seeder
*/
public function run()
{
//
factory(App\Models\Inquiry::class, 50)->create()->each(function ($user) {
$user->insert(factory(\App\Models\Inquiry::class)->make());
});
}
}
......@@ -5,16 +5,26 @@ return [
'inquiry' => 'Inquiry',
],
'fields' => [
'sales_id' => '业务员ID',
'inquiry_sn' => '询价单号',
'status' => '处理状态',
'remark' => '备注',
'priority' => '优先级',
'user_types' => '客户类型',
'processing_time' => '处理时间',
'create_time' => '添加时间',
'update_time' => '修改时间',
'sales_name' => 'Sales Name',
'inquiry_sn' => 'Inquiry Sn',
'status' => 'Status',
'remark' => 'Remark',
'priority' => 'Priority',
'user_types' => 'User Type',
'processing_time' => 'Processing Time',
'create_time' => 'Create Time',
'update_time' => 'update Time',
],
'options' => [
'status' => [
-1 => 'closed',
0 => 'pending',
1 => 'processed'
],
'priority' => [
0 => 'low',
1 => 'middle',
2 => 'high'
]
],
];
......@@ -3,5 +3,6 @@
return [
'titles' => [
'userAddress' => 'UserAddress',
'inquiry' => 'Inquiry',
],
];
<?php
return [
'labels' => [
'Inquiry' => 'Inquiry',
'inquiry' => 'Inquiry',
],
'fields' => [
'sales_id' => '业务员ID',
'inquiry_sn' => '询价单号',
'status' => '处理状态',
'remark' => '备注',
'priority' => '优先级',
'user_types' => '客户类型',
'processing_time' => '处理时间',
'create_time' => '添加时间',
'update_time' => '修改时间',
],
'options' => [
'status' => [
-1 => '已关闭',
0 => '待处理',
1 => '已处理'
],
'priority' => [
0 => '低',
1 => '中',
2 => '高'
]
],
];
......@@ -13,6 +13,7 @@ return [
'extensions' => '扩展',
'scaffold' => '代码生成器',
'icons' => '图标',
'UserAddress' => '用户地址',
'userAddress' => '用户地址',
'inquiry' => '询价管理'
],
];
<?php //90e7615362edd3d7e1558ab0b6171255
<?php //a628f6cb709e35c62b6245ff41ccbfb0
/** @noinspection all */
namespace LaravelIdea\Helper\App\Models {
use App\Models\Inquiry;
use App\Models\InquiryItems;
use App\Models\User;
use App\Models\UserAddress;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Query\Expression;
......@@ -13,6 +15,69 @@ namespace LaravelIdea\Helper\App\Models {
use LaravelIdea\Helper\_BaseCollection;
/**
* @method InquiryItems|$this shift()
* @method InquiryItems|$this pop()
* @method InquiryItems|null get($key, $default = null)
* @method InquiryItems|null pull($key, $default = null)
* @method InquiryItems|null first(callable $callback = null, $default = null)
* @method InquiryItems|null firstWhere(string $key, $operator = null, $value = null)
* @method InquiryItems|null find($key, $default = null)
* @method InquiryItems[] all()
* @method InquiryItems|null last(callable $callback = null, $default = null)
* @method InquiryItems|$this random(int|null $number = null)
*/
class _IH_InquiryItems_C extends _BaseCollection {
/**
* @param int $size
* @return InquiryItems[][]
*/
public function chunk($size)
{
return [];
}
}
/**
* @method _IH_InquiryItems_QB whereItemId($value)
* @method _IH_InquiryItems_QB whereInquiryId($value)
* @method _IH_InquiryItems_QB whereGoodsId($value)
* @method _IH_InquiryItems_QB whereGoodsName($value)
* @method _IH_InquiryItems_QB whereBrandId($value)
* @method _IH_InquiryItems_QB whereBrandName($value)
* @method _IH_InquiryItems_QB whereInquiryNumber($value)
* @method _IH_InquiryItems_QB whereBatch($value)
* @method _IH_InquiryItems_QB whereStatus($value)
* @method _IH_InquiryItems_QB whereRemark($value)
* @method _IH_InquiryItems_QB whereInquiryType($value)
* @method _IH_InquiryItems_QB whereUpdateTime($value)
* @method _IH_InquiryItems_QB whereCreateName($value)
* @method InquiryItems create(array $attributes = [])
* @method _IH_InquiryItems_C|InquiryItems[] cursor()
* @method InquiryItems|null|_IH_InquiryItems_C|InquiryItems[] find($id, array $columns = ['*'])
* @method _IH_InquiryItems_C|InquiryItems[] findMany(array|Arrayable $ids, array $columns = ['*'])
* @method InquiryItems|_IH_InquiryItems_C|InquiryItems[] findOrFail($id, array $columns = ['*'])
* @method InquiryItems|_IH_InquiryItems_C|InquiryItems[] findOrNew($id, array $columns = ['*'])
* @method InquiryItems first(array|string $columns = ['*'])
* @method InquiryItems firstOr(array|\Closure $columns = ['*'], \Closure $callback = null)
* @method InquiryItems firstOrCreate(array $attributes, array $values = [])
* @method InquiryItems firstOrFail(array $columns = ['*'])
* @method InquiryItems firstOrNew(array $attributes = [], array $values = [])
* @method InquiryItems firstWhere(array|\Closure|Expression|string $column, $operator = null, $value = null, string $boolean = 'and')
* @method InquiryItems forceCreate(array $attributes)
* @method _IH_InquiryItems_C|InquiryItems[] fromQuery(string $query, array $bindings = [])
* @method _IH_InquiryItems_C|InquiryItems[] get(array|string $columns = ['*'])
* @method InquiryItems getModel()
* @method InquiryItems[] getModels(array|string $columns = ['*'])
* @method _IH_InquiryItems_C|InquiryItems[] hydrate(array $items)
* @method InquiryItems make(array $attributes = [])
* @method InquiryItems newModelInstance(array $attributes = [])
* @method LengthAwarePaginator|InquiryItems[]|_IH_InquiryItems_C paginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method Paginator|InquiryItems[]|_IH_InquiryItems_C simplePaginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method InquiryItems updateOrCreate(array $attributes, array $values = [])
*/
class _IH_InquiryItems_QB extends _BaseBuilder {}
/**
* @method Inquiry|$this shift()
* @method Inquiry|$this pop()
* @method Inquiry|null get($key, $default = null)
......@@ -36,6 +101,20 @@ namespace LaravelIdea\Helper\App\Models {
}
/**
* @method _IH_Inquiry_QB whereInquiryId($value)
* @method _IH_Inquiry_QB whereUserId($value)
* @method _IH_Inquiry_QB whereSalesId($value)
* @method _IH_Inquiry_QB whereInquirySn($value)
* @method _IH_Inquiry_QB whereSource($value)
* @method _IH_Inquiry_QB whereStatus($value)
* @method _IH_Inquiry_QB whereDeliveryPlace($value)
* @method _IH_Inquiry_QB whereCurrency($value)
* @method _IH_Inquiry_QB whereRemark($value)
* @method _IH_Inquiry_QB wherePriority($value)
* @method _IH_Inquiry_QB whereUserTypes($value)
* @method _IH_Inquiry_QB whereProcessingTime($value)
* @method _IH_Inquiry_QB whereCreateTime($value)
* @method _IH_Inquiry_QB whereUpdateTime($value)
* @method Inquiry create(array $attributes = [])
* @method _IH_Inquiry_C|Inquiry[] cursor()
* @method Inquiry|null|_IH_Inquiry_C|Inquiry[] find($id, array $columns = ['*'])
......@@ -111,4 +190,68 @@ namespace LaravelIdea\Helper\App\Models {
* @method UserAddress updateOrCreate(array $attributes, array $values = [])
*/
class _IH_UserAddress_QB extends _BaseBuilder {}
/**
* @method User|$this shift()
* @method User|$this pop()
* @method User|null get($key, $default = null)
* @method User|null pull($key, $default = null)
* @method User|null first(callable $callback = null, $default = null)
* @method User|null firstWhere(string $key, $operator = null, $value = null)
* @method User|null find($key, $default = null)
* @method User[] all()
* @method User|null last(callable $callback = null, $default = null)
* @method User|$this random(int|null $number = null)
*/
class _IH_User_C extends _BaseCollection {
/**
* @param int $size
* @return User[][]
*/
public function chunk($size)
{
return [];
}
}
/**
* @method _IH_User_QB whereId($value)
* @method _IH_User_QB whereName($value)
* @method _IH_User_QB whereEmail($value)
* @method _IH_User_QB whereEmailVerifiedAt($value)
* @method _IH_User_QB wherePassword($value)
* @method _IH_User_QB wherePhone($value)
* @method _IH_User_QB whereRememberToken($value)
* @method _IH_User_QB whereAccountProperties($value)
* @method _IH_User_QB whereStatus($value)
* @method _IH_User_QB whereCompanyName($value)
* @method _IH_User_QB whereFirstName($value)
* @method _IH_User_QB whereLastName($value)
* @method _IH_User_QB whereCreatedTime($value)
* @method _IH_User_QB whereUpdateTime($value)
* @method User create(array $attributes = [])
* @method _IH_User_C|User[] cursor()
* @method User|null|_IH_User_C|User[] find($id, array $columns = ['*'])
* @method _IH_User_C|User[] findMany(array|Arrayable $ids, array $columns = ['*'])
* @method User|_IH_User_C|User[] findOrFail($id, array $columns = ['*'])
* @method User|_IH_User_C|User[] findOrNew($id, array $columns = ['*'])
* @method User first(array|string $columns = ['*'])
* @method User firstOr(array|\Closure $columns = ['*'], \Closure $callback = null)
* @method User firstOrCreate(array $attributes, array $values = [])
* @method User firstOrFail(array $columns = ['*'])
* @method User firstOrNew(array $attributes = [], array $values = [])
* @method User firstWhere(array|\Closure|Expression|string $column, $operator = null, $value = null, string $boolean = 'and')
* @method User forceCreate(array $attributes)
* @method _IH_User_C|User[] fromQuery(string $query, array $bindings = [])
* @method _IH_User_C|User[] get(array|string $columns = ['*'])
* @method User getModel()
* @method User[] getModels(array|string $columns = ['*'])
* @method _IH_User_C|User[] hydrate(array $items)
* @method User make(array $attributes = [])
* @method User newModelInstance(array $attributes = [])
* @method LengthAwarePaginator|User[]|_IH_User_C paginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method Paginator|User[]|_IH_User_C simplePaginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method User updateOrCreate(array $attributes, array $values = [])
*/
class _IH_User_QB extends _BaseBuilder {}
}
\ No newline at end of file
<?php //2069bb3c683992c9f54736dad970b04e
/** @noinspection all */
namespace LaravelIdea\Helper\App {
use App\User;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Query\Expression;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use LaravelIdea\Helper\_BaseBuilder;
use LaravelIdea\Helper\_BaseCollection;
/**
* @method User|$this shift()
* @method User|$this pop()
* @method User|null get($key, $default = null)
* @method User|null pull($key, $default = null)
* @method User|null first(callable $callback = null, $default = null)
* @method User|null firstWhere(string $key, $operator = null, $value = null)
* @method User|null find($key, $default = null)
* @method User[] all()
* @method User|null last(callable $callback = null, $default = null)
* @method User|$this random(int|null $number = null)
*/
class _IH_User_C extends _BaseCollection {
/**
* @param int $size
* @return User[][]
*/
public function chunk($size)
{
return [];
}
}
/**
* @method User create(array $attributes = [])
* @method _IH_User_C|User[] cursor()
* @method User|null|_IH_User_C|User[] find($id, array $columns = ['*'])
* @method _IH_User_C|User[] findMany(array|Arrayable $ids, array $columns = ['*'])
* @method User|_IH_User_C|User[] findOrFail($id, array $columns = ['*'])
* @method User|_IH_User_C|User[] findOrNew($id, array $columns = ['*'])
* @method User first(array|string $columns = ['*'])
* @method User firstOr(array|\Closure $columns = ['*'], \Closure $callback = null)
* @method User firstOrCreate(array $attributes, array $values = [])
* @method User firstOrFail(array $columns = ['*'])
* @method User firstOrNew(array $attributes = [], array $values = [])
* @method User firstWhere(array|\Closure|Expression|string $column, $operator = null, $value = null, string $boolean = 'and')
* @method User forceCreate(array $attributes)
* @method _IH_User_C|User[] fromQuery(string $query, array $bindings = [])
* @method _IH_User_C|User[] get(array|string $columns = ['*'])
* @method User getModel()
* @method User[] getModels(array|string $columns = ['*'])
* @method _IH_User_C|User[] hydrate(array $items)
* @method User make(array $attributes = [])
* @method User newModelInstance(array $attributes = [])
* @method LengthAwarePaginator|User[]|_IH_User_C paginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method Paginator|User[]|_IH_User_C simplePaginate(int|null $perPage = null, array $columns = ['*'], string $pageName = 'page', int|null $page = null)
* @method User updateOrCreate(array $attributes, array $values = [])
*/
class _IH_User_QB extends _BaseBuilder {}
}
<?php //7e7d4cefee79b7862c26ae2860df2dc8
/** @noinspection all */
namespace App {
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Notifications\DatabaseNotification;
use LaravelIdea\Helper\App\_IH_User_C;
use LaravelIdea\Helper\App\_IH_User_QB;
use LaravelIdea\Helper\Illuminate\Notifications\_IH_DatabaseNotification_C;
use LaravelIdea\Helper\Illuminate\Notifications\_IH_DatabaseNotification_QB;
/**
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $notifications
* @property-read int $notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB notifications()
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $readNotifications
* @property-read int $read_notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB readNotifications()
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $unreadNotifications
* @property-read int $unread_notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB unreadNotifications()
* @method static _IH_User_QB onWriteConnection()
* @method _IH_User_QB newQuery()
* @method static _IH_User_QB on(null|string $connection = null)
* @method static _IH_User_QB query()
* @method static _IH_User_QB with(array|string $relations)
* @method _IH_User_QB newModelQuery()
* @method int increment(string $column, float|int $amount = 1, array $extra = [])
* @method int decrement(string $column, float|int $amount = 1, array $extra = [])
* @method static _IH_User_C|User[] all()
* @mixin _IH_User_QB
*/
class User extends Model {}
}
<?php //6e8e0aa6e8d94f4b186d2a9e1d7c5179
<?php //9d60455bb08465c866796eeaac0df050
/** @noinspection all */
namespace App\Models {
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphToMany;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Support\Carbon;
use LaravelIdea\Helper\App\Models\_IH_InquiryItems_C;
use LaravelIdea\Helper\App\Models\_IH_InquiryItems_QB;
use LaravelIdea\Helper\App\Models\_IH_Inquiry_C;
use LaravelIdea\Helper\App\Models\_IH_Inquiry_QB;
use LaravelIdea\Helper\App\Models\_IH_UserAddress_C;
use LaravelIdea\Helper\App\Models\_IH_UserAddress_QB;
use LaravelIdea\Helper\App\Models\_IH_User_C;
use LaravelIdea\Helper\App\Models\_IH_User_QB;
use LaravelIdea\Helper\Illuminate\Notifications\_IH_DatabaseNotification_C;
use LaravelIdea\Helper\Illuminate\Notifications\_IH_DatabaseNotification_QB;
/**
* @property int $inquiry_id
* @property int $user_id
* @property int $sales_id
* @property string $inquiry_sn
* @property bool $source
* @property bool $status
* @property bool $delivery_place
* @property int $currency
* @property string $remark
* @property bool $priority
* @property bool $user_types
* @property int $processing_time
* @property int $create_time
* @property int $update_time
* @property User $user
* @method BelongsTo|_IH_User_QB user()
* @method static _IH_Inquiry_QB onWriteConnection()
* @method _IH_Inquiry_QB newQuery()
* @method static _IH_Inquiry_QB on(null|string $connection = null)
......@@ -24,6 +50,70 @@ namespace App\Models {
class Inquiry extends Model {}
/**
* @property int $item_id
* @property int $inquiry_id
* @property int $goods_id
* @property string $goods_name
* @property int $brand_id
* @property string $brand_name
* @property int $inquiry_number
* @property string $batch
* @property int $status
* @property string $remark
* @property int $inquiry_type
* @property int $update_time
* @property string $create_name
* @method static _IH_InquiryItems_QB onWriteConnection()
* @method _IH_InquiryItems_QB newQuery()
* @method static _IH_InquiryItems_QB on(null|string $connection = null)
* @method static _IH_InquiryItems_QB query()
* @method static _IH_InquiryItems_QB with(array|string $relations)
* @method _IH_InquiryItems_QB newModelQuery()
* @method int increment(string $column, float|int $amount = 1, array $extra = [])
* @method int decrement(string $column, float|int $amount = 1, array $extra = [])
* @method static _IH_InquiryItems_C|InquiryItems[] all()
* @mixin _IH_InquiryItems_QB
*/
class InquiryItems extends Model {}
/**
* @property int $id
* @property string $name
* @property string $email
* @property Carbon|null $email_verified_at
* @property string $password
* @property string $phone
* @property string $remember_token
* @property int $account_properties
* @property int $status
* @property string $company_name
* @property string $first_name
* @property string $last_name
* @property int $created_time
* @property int $update_time
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $notifications
* @property-read int $notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB notifications()
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $readNotifications
* @property-read int $read_notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB readNotifications()
* @property _IH_DatabaseNotification_C|DatabaseNotification[] $unreadNotifications
* @property-read int $unread_notifications_count
* @method MorphToMany|_IH_DatabaseNotification_QB unreadNotifications()
* @method static _IH_User_QB onWriteConnection()
* @method _IH_User_QB newQuery()
* @method static _IH_User_QB on(null|string $connection = null)
* @method static _IH_User_QB query()
* @method static _IH_User_QB with(array|string $relations)
* @method _IH_User_QB newModelQuery()
* @method int increment(string $column, float|int $amount = 1, array $extra = [])
* @method int decrement(string $column, float|int $amount = 1, array $extra = [])
* @method static _IH_User_C|User[] all()
* @mixin _IH_User_QB
*/
class User extends Model {}
/**
* @method static _IH_UserAddress_QB onWriteConnection()
* @method _IH_UserAddress_QB newQuery()
* @method static _IH_UserAddress_QB on(null|string $connection = null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment