204 lines
6.8 KiB
PHP
204 lines
6.8 KiB
PHP
@extends('admin.master')
|
|
@section("title","Artisan")
|
|
@section("desc","")
|
|
@section('content')
|
|
|
|
<div class="content">
|
|
<div class="row">
|
|
{{col("col-md-6","Schema Generator")}}
|
|
<?php if(getisset("columns")) {
|
|
|
|
$columns = explode("\n", get("columns"));
|
|
$tableName = str_slug(get("table_name"),"_");
|
|
?>
|
|
<pre>
|
|
Schema::create('{{$tableName}}', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->timestamps();
|
|
<?php foreach($columns AS $column) {
|
|
$column = trim($column);
|
|
$column = str_slug($column, '_');
|
|
if(strpos($column, "date") !== false) {
|
|
$type = "date";
|
|
} else {
|
|
$type = "string";
|
|
}
|
|
if($type == "string") {
|
|
|
|
?>$table->string('{{$column}}', 100)->nullable()->default(null);
|
|
<?php } else {
|
|
?>$table->date('{{$column}}')->nullable()->default(null);
|
|
<?php
|
|
} ?>
|
|
<?php
|
|
} ?>
|
|
|
|
});
|
|
</pre>
|
|
|
|
<?php
|
|
|
|
} ?>
|
|
<form action="?testa" method="get">
|
|
@csrf
|
|
Table Name:
|
|
<input type="text" name="table_name" id="" class="form-control">
|
|
Column List:
|
|
<textarea name="columns" id="" cols="30" rows="10" class="form-control"></textarea>
|
|
<button class="btn btn-primary">Generate Migration Schema</button>
|
|
</form>
|
|
|
|
{{_col()}}
|
|
{{col("col-md-6","Table Column To Array")}}
|
|
<?php if(getisset("table_name")) {
|
|
|
|
$columns = table_columns(get("table_name"));
|
|
|
|
?>
|
|
<div class="form-group">
|
|
<label>Generated Array:</label>
|
|
<textarea class="form-control" rows="7" readonly >[
|
|
<?php foreach($columns AS $column) {
|
|
$column = trim($column);
|
|
$column = str_slug($column, '_');
|
|
?>'{{$column}}',
|
|
<?php
|
|
} ?>
|
|
]</textarea>
|
|
<small class="text-muted">Click to select all</small>
|
|
</div>
|
|
|
|
<?php
|
|
|
|
} ?>
|
|
<form action="?array" method="get">
|
|
@csrf
|
|
Table Name:
|
|
<select name="table_name" id="tableSelect" class="form-control select2">
|
|
<option value="">Select a table</option>
|
|
@foreach(DB::select('SHOW TABLES') as $table)
|
|
@php
|
|
$tableName = array_values((array)$table)[0];
|
|
@endphp
|
|
<option value="{{ $tableName }}" {{ get("table_name") == $tableName ? 'selected' : '' }}>
|
|
{{ $tableName }}
|
|
</option>
|
|
@endforeach
|
|
</select>
|
|
<button class="btn btn-primary">Generate Table Column To Array</button>
|
|
</form>
|
|
|
|
{{_col()}}
|
|
{{col("col-md-6","Array")}}
|
|
<?php if(getisset("columns2")) {
|
|
|
|
$columns = explode("\n", get("columns2"));
|
|
|
|
?>
|
|
<pre>
|
|
[
|
|
<?php foreach($columns AS $column) {
|
|
$column = trim($column);
|
|
$column = str_slug($column, '_');
|
|
?>'{{$column}}',
|
|
<?php
|
|
} ?>
|
|
]
|
|
</pre>
|
|
|
|
<?php
|
|
|
|
} ?>
|
|
<form action="?array" method="get">
|
|
@csrf
|
|
Column List:
|
|
<textarea name="columns2" id="" cols="30" rows="10" class="form-control"></textarea>
|
|
<button class="btn btn-primary">Generate Array</button>
|
|
</form>
|
|
|
|
{{_col()}}
|
|
</div>
|
|
<div class="block">
|
|
<div class="block-header block-header-default">
|
|
<h3 class="block-title">{{__('Artisan Command Panel')}}</h3>
|
|
<div class="block-options">
|
|
|
|
</div>
|
|
</div>
|
|
<div class="block-content">
|
|
<?php if(getisset("command")) {
|
|
try {
|
|
dump(get("command"));
|
|
$command = str_replace("\\","/",get("command"));
|
|
Artisan::call($command);
|
|
$output = Artisan::output();
|
|
|
|
ekle2([
|
|
'title' => $command,
|
|
'html' => $output,
|
|
'type' => 'ARTISAN',
|
|
'kid' => 'ARTISAN'
|
|
],"contents");
|
|
|
|
dump($output);
|
|
|
|
} catch (\Throwable $th) {
|
|
dump($th);
|
|
}
|
|
|
|
} ?>
|
|
<form action="" method="get">
|
|
<?php $macros = [
|
|
'make:migration MigrationName',
|
|
'migrate:refresh --path=',
|
|
'make:model ModelName -a',
|
|
'cache:clear',
|
|
];
|
|
foreach($macros AS $macro) {
|
|
|
|
?>
|
|
<div class="btn btn-outline-success" onclick="$('#command').val($(this).text().trim()).focus()">{{$macro}}</div>
|
|
<?php } ?>
|
|
<div class="input-group">
|
|
|
|
<input type="text" name="command" value="{{get("command")}}" required id="command" class="form-control">
|
|
<button class="btn btn-primary"><i class="fa fa-cog"></i></button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="table-responsive">
|
|
<table class="table table-bordered">
|
|
<tr>
|
|
<th style="width:50%">Command</th>
|
|
<th>Output</th>
|
|
</tr>
|
|
<?php $query = db("contents")->where("type","ARTISAN")->orderBy("id","DESC")->simplePaginate(100);
|
|
foreach($query AS $q) {
|
|
|
|
?>
|
|
<tr>
|
|
<td><?php echo $q->title ?></td>
|
|
<td><textarea name="" id="" cols="30" rows="1" class="form-control"><?php echo $q->html ?></textarea></td>
|
|
</tr>
|
|
<?php } ?>
|
|
</table>
|
|
</div>
|
|
{{$query->links()}}
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
$(document).ready(function() {
|
|
$('#tableSelect').select2({
|
|
placeholder: "Select a table",
|
|
allowClear: true
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|