first commit
This commit is contained in:
commit
c569ea1d0c
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/.phpunit.cache
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/vendor
|
||||||
|
/laravel.log
|
||||||
|
.env
|
||||||
|
.htaccess
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
auth.json
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
||||||
|
/.zip
|
||||||
|
*.zip
|
5577
aaa/clients_trusteducation (1).sql
Normal file
5577
aaa/clients_trusteducation (1).sql
Normal file
File diff suppressed because one or more lines are too long
BIN
app/.DS_Store
vendored
Normal file
BIN
app/.DS_Store
vendored
Normal file
Binary file not shown.
27
app/Console/Kernel.php
Normal file
27
app/Console/Kernel.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console;
|
||||||
|
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||||
|
|
||||||
|
class Kernel extends ConsoleKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the application's command schedule.
|
||||||
|
*/
|
||||||
|
protected function schedule(Schedule $schedule): void
|
||||||
|
{
|
||||||
|
// $schedule->command('inspire')->hourly();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the commands for the application.
|
||||||
|
*/
|
||||||
|
protected function commands(): void
|
||||||
|
{
|
||||||
|
$this->load(__DIR__.'/Commands');
|
||||||
|
|
||||||
|
require base_path('routes/console.php');
|
||||||
|
}
|
||||||
|
}
|
30
app/Exceptions/Handler.php
Normal file
30
app/Exceptions/Handler.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Exceptions;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class Handler extends ExceptionHandler
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The list of the inputs that are never flashed to the session on validation exceptions.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $dontFlash = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the exception handling callbacks for the application.
|
||||||
|
*/
|
||||||
|
public function register(): void
|
||||||
|
{
|
||||||
|
$this->reportable(function (Throwable $e) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
11
app/Handlers/LfmConfigHandler.php
Normal file
11
app/Handlers/LfmConfigHandler.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Handlers;
|
||||||
|
|
||||||
|
class LfmConfigHandler extends \UniSharp\LaravelFilemanager\Handlers\ConfigHandler
|
||||||
|
{
|
||||||
|
public function userField()
|
||||||
|
{
|
||||||
|
return parent::userField();
|
||||||
|
}
|
||||||
|
}
|
194
app/Helpers/BibClass.php
Normal file
194
app/Helpers/BibClass.php
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Helpers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class BibClass
|
||||||
|
{
|
||||||
|
static function createSelect($HTMLLabel, $tableName, $valueField, $displayField, $condition = "", $defaultValue = "", $HTMLName = "", $HTMLId = "", $HTMLClass = "", $HTMLRequired = "")
|
||||||
|
{
|
||||||
|
$tableName = strtolower($tableName);
|
||||||
|
$query = "SELECT $valueField, $displayField FROM $tableName";
|
||||||
|
if ($condition != "") {
|
||||||
|
$query .= " WHERE $condition";
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = DB::select(DB::raw($query));
|
||||||
|
?>
|
||||||
|
<label for="<?php echo $HTMLId; ?>" class="form-label col-form-label"> <?php echo label($HTMLLabel); ?> </label>
|
||||||
|
<select class="form-select <?php echo $HTMLClass ?>" name="<?php echo $HTMLName; ?>" data-search="true" id="<?php echo $HTMLId; ?>" aria-label="Default select example" <?php echo ($HTMLRequired) ? "Required" : ""; ?>>
|
||||||
|
<option value=""><?php label("Select Option"); ?></option>
|
||||||
|
<?php foreach ($results as $item) { ?>
|
||||||
|
<option value="<?php echo $item->$valueField ?>" <?php echo $item->$valueField == $defaultValue ? 'selected' : '' ?>><?php echo $item->$displayField ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<p id='error_<?php echo $HTMLName; ?>' class='text-danger custom-error'></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
static function lookupField($tableName, $field, $refField, $refValue)
|
||||||
|
{
|
||||||
|
$tableName = strtolower($tableName);
|
||||||
|
$t = "select $field from $tableName where $refField = '$refValue'";
|
||||||
|
$Value = DB::select($t);
|
||||||
|
|
||||||
|
if (!empty($Value)) {
|
||||||
|
return $Value[0]->$field;
|
||||||
|
} else {
|
||||||
|
return "Not Found in Table";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static function getRow($tableName, $condition = "1")
|
||||||
|
{
|
||||||
|
$tableName = strtolower($tableName);
|
||||||
|
$t = "select * from $tableName where $condition";
|
||||||
|
$Value = DB::select($t);
|
||||||
|
return (empty($Value) ? "Not Found" : $Value[0]);
|
||||||
|
}
|
||||||
|
static function getRowByQuery($query)
|
||||||
|
{
|
||||||
|
$Value = DB::select($query);
|
||||||
|
return (empty($Value) ? false : $Value[0]);
|
||||||
|
}
|
||||||
|
static function getTableByQuery($query)
|
||||||
|
{
|
||||||
|
$Value = DB::select($query);
|
||||||
|
|
||||||
|
return (empty($Value) ? false : $Value);
|
||||||
|
}
|
||||||
|
static function updateRow($tableName, $fieldName, $fieldValue, $referenceField, $referenceValue)
|
||||||
|
{
|
||||||
|
$tableName = strtolower($tableName);
|
||||||
|
$t = "update $tableName set $fieldName='$fieldValue' where $referenceField=$referenceValue";
|
||||||
|
return DB::select($t);
|
||||||
|
}
|
||||||
|
public static function pre($array)
|
||||||
|
{
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($array);
|
||||||
|
echo "</pre>";
|
||||||
|
}
|
||||||
|
public static function addButton($path, $text)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<a href="<?php echo url($path); ?>" class="btn btn-primary btn-sm pull-right">
|
||||||
|
<em class="icon ni ni-plus"></em><span><?php echo $text; ?></span>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
public static function addRowActions($pk)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
echo "<ul class=\"d-flex flex-wrap\">
|
||||||
|
<li><a href=\"#\" type=\"button\" class=\"btn btn-color-success btn-hover-success btn-icon btn-soft\" ><em class=\"icon ni ni-eye\"></em></a></li>
|
||||||
|
<li><a href=\"form2.php\" type=\"button\" class=\"btn btn-color-primary btn-hover-primary btn-icon btn-soft\" data-bs-toggle=\"tooltip\" data-bs-placement=\"top\" data-bs-custom-class=\"custom-tooltip\" title=\"Edit\"> <em class=\"icon ni ni-edit\"></em></a></li>
|
||||||
|
<li><button type=\"button\" class=\"btn btn-color-danger btn-hover-danger btn-icon btn-soft\"><em class=\"icon ni ni-trash\"></em></button></li>
|
||||||
|
</ul>";
|
||||||
|
BibClass::addButton("edit/$pk", 'Edit');
|
||||||
|
BibClass::addButton("view/$pk", 'View');
|
||||||
|
BibClass::addButton("destroy/$pk", 'Delete');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getController()
|
||||||
|
{
|
||||||
|
$routeArray = app('request')->route()->getAction();
|
||||||
|
$controllerAction = class_basename($routeArray['controller']);
|
||||||
|
list($controller, $action) = explode('@', $controllerAction);
|
||||||
|
|
||||||
|
print_r($controller);
|
||||||
|
}
|
||||||
|
public static function createSidebarMenu($link, $name, $target = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<li class="nk-menu-item"><a href="<?php echo $link; ?>" class="nk-menu-link" <?php echo ($target != "") ? "target=\"_blank\"" : ""; ?>><span class="nk-menu-text"><?php echo $name; ?></span></a></li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function dataTable($TableRows, $TableName)
|
||||||
|
{
|
||||||
|
$TableName = strtolower($TableName);
|
||||||
|
$Table_pk = str_replace("tbl_", "", $TableName) . "_id";
|
||||||
|
$TableCols = array_keys((array)$TableRows[0]);
|
||||||
|
|
||||||
|
//BibClass::pre($TableCols);
|
||||||
|
?>
|
||||||
|
<table class="datatable-init table" data-nk-container="table-responsive table-border">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($TableCols as $TableCol) : //echo $TableCol;
|
||||||
|
?>
|
||||||
|
<?php switch ($TableCol) {
|
||||||
|
case $Table_pk:
|
||||||
|
case 'created_by':
|
||||||
|
case 'created_on':
|
||||||
|
case 'remarks':
|
||||||
|
case 'status':
|
||||||
|
case 'created_at':
|
||||||
|
case 'updated_at':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
?>
|
||||||
|
<th class="text-nowrap"><span class="overline-title"><?php echo label($TableCol); ?></span>
|
||||||
|
</th>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($TableRows as $TableRow) : ?>
|
||||||
|
<tr>
|
||||||
|
<?php foreach ($TableCols as $TableCol) : //echo $TableCol;
|
||||||
|
?>
|
||||||
|
<?php switch ($TableCol) {
|
||||||
|
case $Table_pk:
|
||||||
|
case 'created_by':
|
||||||
|
case 'created_on':
|
||||||
|
case 'remarks':
|
||||||
|
case 'status':
|
||||||
|
case 'created_at':
|
||||||
|
case 'updated_at':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
?>
|
||||||
|
<th class="text-nowrap"><span class="overline-title"><?php echo $TableRow->$TableCol; ?></span>
|
||||||
|
</th>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
public static function tableEntryForm($tableName)
|
||||||
|
{
|
||||||
|
$tableName = strtolower($tableName);
|
||||||
|
$Table_pk = str_replace("tbl_", "", $tableName) . "_id";
|
||||||
|
$tableFields = DB::select("describe " . $tableName);
|
||||||
|
foreach ($tableFields as $tableField) {
|
||||||
|
$tableField = $tableField->Field;
|
||||||
|
switch ($tableField) {
|
||||||
|
case $Table_pk:
|
||||||
|
case 'status':
|
||||||
|
case 'created_at':
|
||||||
|
case 'updated_at':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
createInput("text", $tableField, $tableField, $tableField, "", "", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
app/Helpers/CCMS.php
Normal file
43
app/Helpers/CCMS.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Menuitems;
|
||||||
|
use App\Models\Menulocations;
|
||||||
|
use App\Models\Preparationclasses;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CCMS
|
||||||
|
{
|
||||||
|
// public function __construct()
|
||||||
|
// {
|
||||||
|
// $this->initDB();
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// public static function getSiteVars()
|
||||||
|
// {
|
||||||
|
// $siteVars = DB::table("settings")->where('status', 1)->orderby('display_order')->first();
|
||||||
|
// return $siteVars;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private function initDB()
|
||||||
|
// {
|
||||||
|
// static $initialized = false;
|
||||||
|
// if (!$initialized) {
|
||||||
|
|
||||||
|
|
||||||
|
// if (!(DB::table('users')->first())) {
|
||||||
|
// DB::statement("INSERT INTO `tbl_users` (`name`,`email`,`username`,`password`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1');");
|
||||||
|
// }
|
||||||
|
// if (!(DB::table('settings')->first())) {
|
||||||
|
// DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) values ('Bibhuti LMS', '', '1');");
|
||||||
|
// }
|
||||||
|
// if (!(DB::table('articles')->first())) {
|
||||||
|
// DB::statement("INSERT INTO `tbl_articles` (`title`,`alias`, `text`, `status`) VALUES ('Company Profile', 'company-profile','Welcome Article', '1');");
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $initialized = true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
681
app/Helpers/bibHelper.php
Normal file
681
app/Helpers/bibHelper.php
Normal file
@ -0,0 +1,681 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Helpers\BibClass;
|
||||||
|
use App\Http\Controllers\NepaliDictonary\DictonaryController;
|
||||||
|
use App\Models\Log\ActivityLog;
|
||||||
|
use App\Models\Log\ErrorLog;
|
||||||
|
use App\Models\Log\OperationLog;
|
||||||
|
use Illuminate\Support\Facades\App;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
function pre($object, $die = false)
|
||||||
|
{
|
||||||
|
echo "<pre>";
|
||||||
|
print_r($object);
|
||||||
|
echo "</pre>";
|
||||||
|
if ($die) die;
|
||||||
|
}
|
||||||
|
function label($text, $echo = true)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if ($echo) {
|
||||||
|
echo $text;
|
||||||
|
} else {
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function template($filepath)
|
||||||
|
{
|
||||||
|
$filepath = env("APP_URL") . "/layout/" . $filepath;
|
||||||
|
// $filepath=str_replace('\\','/',env("APP_URL")."/layout/".$filepath);
|
||||||
|
echo $filepath;
|
||||||
|
// return
|
||||||
|
}
|
||||||
|
if (!function_exists('N2')) {
|
||||||
|
function N2($N)
|
||||||
|
{
|
||||||
|
return number_format($N, 2, '.', ',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!function_exists('slugify')) {
|
||||||
|
function slugify($text, $tableName = null)
|
||||||
|
{
|
||||||
|
// Generate the initial slug from the text
|
||||||
|
$slug = preg_replace('/[^a-zA-Z0-9\-]/', '-', $text);
|
||||||
|
$slug = preg_replace('/-+/', '-', $slug);
|
||||||
|
$slug = trim($slug, '-');
|
||||||
|
$slug = strtolower($slug);
|
||||||
|
|
||||||
|
// If the table name is provided, check for uniqueness and modify the slug if needed
|
||||||
|
if ($tableName) {
|
||||||
|
$originalSlug = $slug;
|
||||||
|
$count = 1;
|
||||||
|
|
||||||
|
while (isSlugExists($tableName, $slug)) {
|
||||||
|
$slug = $originalSlug . '-' . $count;
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $slug;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!function_exists('isSlugExists')) {
|
||||||
|
function isSlugExists($tableName, $slug)
|
||||||
|
{
|
||||||
|
$aliasField = 'alias';
|
||||||
|
$count = DB::table($tableName)
|
||||||
|
->where($aliasField, $slug)
|
||||||
|
->count();
|
||||||
|
return $count > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function createButton($class = "", $type = "submit", $display = "Submit", $url = "")
|
||||||
|
{
|
||||||
|
if (!$url) :
|
||||||
|
?>
|
||||||
|
<button class="btn <?php echo $class; ?>" type="<?php echo ($display == "Submit") ? $display : $type; ?>">
|
||||||
|
<?php echo label($display) ?>
|
||||||
|
</button>
|
||||||
|
<?php
|
||||||
|
else :
|
||||||
|
?>
|
||||||
|
<a class="btn <?php echo $class; ?>" href="<?php echo $url; ?>">
|
||||||
|
<?php echo label($display) ?>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
}
|
||||||
|
function createText($name, $id, $display, $class = "", $value = "", $placeHolder = "", $readonly = "", $required = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<?php if ($display != "") : ?><label for="<?php echo $id; ?>" class="form-label col-form-label"> <?php echo label($display); ?> </label><?php endif; ?>
|
||||||
|
<div class="form-control-wrap">
|
||||||
|
<input type="text" id="<?php echo $id; ?>" <?php echo $readonly; ?> placeholder="<?php echo $placeHolder; ?>" name="<?php echo $name; ?>" class="form-control <?php echo $class; ?>" value="<?php echo $value; ?>" <?php if ($required != "") : ?>required<?php endif; ?>>
|
||||||
|
</div>
|
||||||
|
<p id='error_<?php echo $name; ?>' class='text-danger custom-error'></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* $tableName = Name of table
|
||||||
|
* $pk = primary key of table
|
||||||
|
* $name = table select column name
|
||||||
|
* $class = extra class
|
||||||
|
* $data = Existing data or for edit case showing selected data
|
||||||
|
* $display = Displaying name or showing label name.
|
||||||
|
*/
|
||||||
|
function getSelectForForeignColumn($tableName, $pk, $name, $class = "form-control", $data = null, $display = null, $customColumnName = null)
|
||||||
|
{
|
||||||
|
$tableName = strtolower(trim($tableName));
|
||||||
|
$pk = trim($pk);
|
||||||
|
$name = trim($name);
|
||||||
|
$class = trim($class);
|
||||||
|
$systems = DB::table($tableName)->where('status', '<>', -1)->orderBy($pk, 'asc')->pluck($name, $pk);
|
||||||
|
$customColumnName = !empty($customColumnName) ? $customColumnName : $pk; //if we pass column name other then primary key.
|
||||||
|
customCreateSelect($pk, $pk, $class, $display ?? $name, $systems, ($data) ? $data->$customColumnName : null);
|
||||||
|
}
|
||||||
|
function customCreateSelect($name, $id, $class = "form-control", $display = '', $values = array(), $defaultValue = '')
|
||||||
|
{
|
||||||
|
$disabled = (in_array("DISABLED", explode(" ", strtoupper($class)))) ? "Disabled" : false;
|
||||||
|
$required = (in_array("REQUIRED", explode(" ", strtoupper($class)))) ? "Required" : false;
|
||||||
|
?><label for="<?php echo $id; ?>" class="form-label col-form-label"> <?php echo label($display); ?> </label>
|
||||||
|
<?php if ($disabled) : ?>
|
||||||
|
<input type="hidden" name="<?php echo $name; ?>" value="<?php echo $defaultValue; ?>" /><?php endif; ?>
|
||||||
|
<select class="form-select <?php echo $class ?>" name="<?php echo $name; ?>" data-search="true" id="<?php echo $name; ?>" aria-label="Default select example" <?php echo ($disabled) ? "Disabled" : ""; ?> <?php echo ($required) ? "Required" : ""; ?>>
|
||||||
|
<option value=""><?php label("Select Option"); ?></option>
|
||||||
|
<?php foreach ($values as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>" <?php echo $defaultValue == $key ? 'selected' : '' ?>><?= $value ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<p id='error_<?php echo $name; ?>' class='text-danger custom-error'></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
function createCustomSelectFromArray($Array, $displayTextForLabel, $HTMLElementName, $defaultValueSelected = '', $additionalClass = "form-control")
|
||||||
|
{
|
||||||
|
$disabled = (in_array("DISABLED", explode(" ", strtoupper($additionalClass)))) ? "Disabled" : false;
|
||||||
|
$required = (in_array("REQUIRED", explode(" ", strtoupper($additionalClass)))) ? "Required" : false;
|
||||||
|
?>
|
||||||
|
<label for="<?php echo $HTMLElementName; ?>" class="form-label col-form-label"> <?php echo label($displayTextForLabel); ?> </label>
|
||||||
|
<?php if ($disabled) : ?>
|
||||||
|
<input type="hidden" name="<?php echo $HTMLElementName; ?>" value="<?php echo $defaultValueSelected; ?>" />
|
||||||
|
<?php endif; ?>
|
||||||
|
<select class="form-select <?php echo $additionalClass ?>" name="<?php echo $HTMLElementName; ?>" data-search="true" id="<?php echo $HTMLElementName; ?>" aria-label="Default select example" <?php echo ($disabled) ? "Disabled" : ""; ?> <?php echo ($required) ? "Required" : ""; ?>>
|
||||||
|
<option <?php if ($required) : ?>value="-1" <?php endif; ?>><?php label("Select Option"); ?></option>
|
||||||
|
<?php foreach ($Array as $option) : ?>
|
||||||
|
<option value="<?php echo $option['value']; ?>" <?php echo $defaultValueSelected == $option['value'] ? 'selected' : ''; ?>>
|
||||||
|
<?php echo $option['display']; ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</select>
|
||||||
|
<p id='error_<?php echo $HTMLElementName; ?>' class='text-danger custom-error'></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function createCustomSelect($tableName, $fieldNameToDisplay, $fieldNameForValue, $defaultValueSelected, $displayTextForLabel, $HTMLElementName, $additionalClass = "form-control", $defaultCondition = null)
|
||||||
|
{
|
||||||
|
// Supply conditions as $defaultCondition = "column_name = 'value'";
|
||||||
|
$tableName = strtolower(trim($tableName));
|
||||||
|
$fieldNameToDisplay = trim($fieldNameToDisplay);
|
||||||
|
$fieldNameForValue = trim($fieldNameForValue);
|
||||||
|
$additionalClass = trim($additionalClass);
|
||||||
|
|
||||||
|
$query = DB::table(DB::raw("`$tableName`"))->where('status', '<>', -1);
|
||||||
|
|
||||||
|
if ($defaultCondition) {
|
||||||
|
$query->whereRaw($defaultCondition);
|
||||||
|
}
|
||||||
|
|
||||||
|
$systems = $query->orderBy($fieldNameForValue, 'asc')->pluck($fieldNameToDisplay, $fieldNameForValue);
|
||||||
|
|
||||||
|
?><label class="form-label col-form-label"><?php echo label($displayTextForLabel); ?></label>
|
||||||
|
<select class="form-select <?php echo $additionalClass; ?>" name="<?php echo $HTMLElementName; ?>" data-search="true" aria-label="" <?php if (stripos($additionalClass, 'required') !== false) {
|
||||||
|
echo "REQUIRED";
|
||||||
|
} ?>>
|
||||||
|
<?php if (stripos($additionalClass, 'required') !== false) { ?>
|
||||||
|
<option value=""><?php label("Select Option"); ?></option>
|
||||||
|
<?php } else { ?>
|
||||||
|
<option value="0"><?php label("Select Option"); ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
<?php foreach ($systems as $key => $value) { ?>
|
||||||
|
<option value="<?= $key ?>" <?php echo $defaultValueSelected == $key ? 'selected' : '' ?>><?= $value ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
<p id='error_<?php echo $fieldNameForValue; ?>' class='text-danger custom-error'></p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function createImageInput($name, $display = "", $class = "", $default = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<a id="<?php echo $name; ?>" data-input="<?php echo $name; ?>_url" data-preview="<?php echo $name; ?>holder" class="btn btn-primary">
|
||||||
|
<i class="fa fa-picture-o"></i> <?php echo ($display != "") ? $display : "Upload"; ?>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<input id="<?php echo $name; ?>_url" class="form-control lfm <?php echo $class; ?>" type="text" name="<?php echo $name; ?>" <?php if ($default != "") : ?> value="<?php echo env("APP_URL") . "/" . $default; ?>" <?php endif; ?> multiple>
|
||||||
|
</div>
|
||||||
|
<div id="<?php echo $name; ?>holder" style="margin-top:15px;max-height:80px;overflow:hidden;">
|
||||||
|
<?php if ($default != "") : ?> <img src="<?php echo env("APP_URL") . "/" . $default; ?>" style="height: 5rem" /> <?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
collectScripts(function () use ($name) {
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
lfm('<?php echo $name; ?>', 'image', {
|
||||||
|
prefix: '<?php echo env("APP_URL"); ?>/files'
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php });
|
||||||
|
}
|
||||||
|
|
||||||
|
function createMultiImageInput($name, $display = "", $class = "", $default = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<a id="<?php echo $name; ?>" data-input="<?php echo $name; ?>_url" data-preview="<?php echo $name; ?>holder" class="btn btn-primary">
|
||||||
|
<i class="fa fa-picture-o"></i> <?php echo ($display != "") ? $display : "Choose Photo"; ?>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
<input id="<?php echo $name; ?>_url" class="form-control lfm <?php echo $class; ?>" type="text" name="<?php echo $name; ?>" <?php if ($default != "") : ?> value="<?php echo env("APP_URL") . "/" . $default; ?>" <?php endif; ?> multiple>
|
||||||
|
</div>
|
||||||
|
<div id="<?php echo $name; ?>holder" style="margin-top:15px;max-height:80px;overflow:hidden;">
|
||||||
|
<?php if ($default != "") : ?> <img src="<?php echo env("APP_URL") . "/" . $default; ?>" style="height: 5rem" /> <?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
collectScripts(function () use ($name) {
|
||||||
|
?>
|
||||||
|
<script>
|
||||||
|
lfm('<?php echo $name; ?>', 'image', {
|
||||||
|
prefix: '<?php echo env("APP_URL"); ?>/files',
|
||||||
|
type: 'file',
|
||||||
|
multi_selection: true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php });
|
||||||
|
}
|
||||||
|
|
||||||
|
function site_url($url = "")
|
||||||
|
{
|
||||||
|
return env("APP_URL") . "/" . trim($url, "/");
|
||||||
|
}
|
||||||
|
function base_url($url = "")
|
||||||
|
{
|
||||||
|
return env("APP_URL") . "/" . trim($url, "/");
|
||||||
|
}
|
||||||
|
function showImageThumb($url)
|
||||||
|
{ ?>
|
||||||
|
<div style="max-height:40px;overflow:hidden">
|
||||||
|
<?php if ($url != "") : ?> <img src="<?php echo env("APP_URL") . "/" . $url; ?>" style="height: 40px;" class="img-fluid" /> <?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
function getFieldData($tableName, $returnField, $referenceFieldName, $referenceValue)
|
||||||
|
{
|
||||||
|
$tableName = strtolower(trim($tableName));
|
||||||
|
$returnField = trim($returnField);
|
||||||
|
$referenceFieldName = trim($referenceFieldName);
|
||||||
|
|
||||||
|
$query = DB::table(DB::raw("`$tableName`"))->where($referenceFieldName, $referenceValue);
|
||||||
|
|
||||||
|
$fieldData = ($query->value($returnField)) ? $query->value($returnField) : "N/A";
|
||||||
|
|
||||||
|
return $fieldData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function createErrorParagraph($name, $class = null)
|
||||||
|
{
|
||||||
|
echo "<p id='error_$name' class='text-danger custom-error $class'></p>";
|
||||||
|
}
|
||||||
|
function createActivityLog($controllerName, $methodName, $activity)
|
||||||
|
{
|
||||||
|
$user_id = auth()->user()->id;
|
||||||
|
ActivityLog::create([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'controllerName' => $controllerName,
|
||||||
|
'methodName' => $methodName,
|
||||||
|
'actionUrl' => request()->fullUrl(),
|
||||||
|
'activity' => $activity,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
function getOperationNumber()
|
||||||
|
{
|
||||||
|
$startNumber = date('YmdHis') . rand(1000, 9999);
|
||||||
|
$isExists = OperationLog::where('operation_end_no', $startNumber)->first();
|
||||||
|
while ($isExists) {
|
||||||
|
$startNumber = date('YmdHis') . rand(1000, 9999);
|
||||||
|
$isExists = OperationLog::where('operation_end_no', $startNumber)->first();
|
||||||
|
}
|
||||||
|
return $startNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createOperationLog($startOperationNumber, $endOperationNumber, $modelName, $modelId, $operationName, $previousValues, $newValues)
|
||||||
|
{
|
||||||
|
$operationId = getOperationNumber();
|
||||||
|
$user_id = auth()->user()->id;
|
||||||
|
OperationLog::create([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'operation_start_no' => $startOperationNumber,
|
||||||
|
'operation_end_no' => $endOperationNumber,
|
||||||
|
'model_name' => $modelName,
|
||||||
|
'model_id' => $modelId,
|
||||||
|
'operation_name' => $operationName,
|
||||||
|
'previous_values' => $previousValues ? json_encode($previousValues) : null,
|
||||||
|
'new_values' => $newValues ? json_encode($newValues) : null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
function createErrorLog($controllerName, $methodName, $errors)
|
||||||
|
{
|
||||||
|
$user_id = (auth()->user()) ? auth()->user()->id : "0";
|
||||||
|
ErrorLog::create([
|
||||||
|
'user_id' => $user_id,
|
||||||
|
'controller_name' => $controllerName,
|
||||||
|
'method_name' => $methodName,
|
||||||
|
'errors' => $errors,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
function createDate($name, $display = "", $class = "datepicker", $default = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="<?php echo $name; ?>" class="form-label col-form-label"><?php echo label($display); ?></label>
|
||||||
|
<div class="form-control-wrap">
|
||||||
|
<input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" class="form-control datepicker<?php echo $class; ?>" value="<?php echo $default; ?>" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
function createTextArea($name, $class = "", $display = "", $default = "", $row = "")
|
||||||
|
{
|
||||||
|
$hasCkeditorClassic = strpos($class, 'ckeditor-classic') !== false;
|
||||||
|
$uploadUrlAttribute = $hasCkeditorClassic ? ' data-upload-url="' . route('upload') . '"' : '';
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="<?php echo $name; ?>" class="form-label col-form-label"><?php echo label($display); ?></label>
|
||||||
|
<div class="form-control-wrap">
|
||||||
|
<textarea class="form-control text-area <?php echo $class; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" rows="<?php echo $row; ?>" <?php echo $uploadUrlAttribute; ?>><?php if (isset($default)) {
|
||||||
|
echo ($default);
|
||||||
|
} ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
function createPlainTextArea($name, $class = "", $display = "", $default = "", $row = "")
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="<?php echo $name; ?>" class="form-label col-form-label"><?php echo label($display); ?></label>
|
||||||
|
<div class="form-control-wrap">
|
||||||
|
<textarea class="form-control text-area <?php echo $class; ?>" name="<?php echo $name; ?>" id="<?php echo $name; ?>" rows="<?php echo $row; ?>"><?php if (isset($default)) {
|
||||||
|
echo ($default);
|
||||||
|
} ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getDisplayOrder($tableName)
|
||||||
|
{
|
||||||
|
// echo $tableName;die;
|
||||||
|
$maxDisplayOrder = DB::select("select max(display_order) as display_order from $tableName")[0]->display_order;
|
||||||
|
$nextDisplayOrder = $maxDisplayOrder + 1;
|
||||||
|
return $nextDisplayOrder;
|
||||||
|
}
|
||||||
|
function getAlias($textField, $tableName)
|
||||||
|
{
|
||||||
|
|
||||||
|
$maxDisplayOrder = DB::select("select max(display_order) as display_order from $tableName")[0]->display_order;
|
||||||
|
$nextDisplayOrder = $maxDisplayOrder + 1;
|
||||||
|
return $nextDisplayOrder;
|
||||||
|
}
|
||||||
|
if (!function_exists('myDate')) {
|
||||||
|
function myDate($originalDate)
|
||||||
|
{
|
||||||
|
return date("F d Y", strtotime($originalDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('dbDate')) {
|
||||||
|
function dbDate($date)
|
||||||
|
{
|
||||||
|
return date("Y-m-d", strtotime($date));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('myTime')) {
|
||||||
|
function myTime($originalDate)
|
||||||
|
{
|
||||||
|
return date("g:i A", strtotime($originalDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('myDateTime')) {
|
||||||
|
function myDateTime($originalDate)
|
||||||
|
{
|
||||||
|
return date("F d Y g:i A", strtotime($originalDate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('myDaysDiff')) {
|
||||||
|
function myDaysDiff($fromDate, $toDate)
|
||||||
|
{
|
||||||
|
$fromDate = strtotime($fromDate);
|
||||||
|
$toDate = strtotime($toDate);
|
||||||
|
$datediff = $toDate - $fromDate;
|
||||||
|
return round($datediff / (60 * 60 * 24));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('firstDayOfNepaliMonth')) {
|
||||||
|
function firstDayOfNepaliMonth($engDate = "")
|
||||||
|
{
|
||||||
|
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||||
|
$NepaliDate = NepaliDate($engDate);
|
||||||
|
$nD = explode("-", $NepaliDate);
|
||||||
|
$Day = '1';
|
||||||
|
$Month = $nD[1];
|
||||||
|
$Year = $nD[0];
|
||||||
|
$t = "select bs_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'";
|
||||||
|
return DB::select($t)[0]->bs_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('firstDayOfNepaliMonth1')) {
|
||||||
|
function firstDayOfNepaliMonth1($engDate = "")
|
||||||
|
{
|
||||||
|
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||||
|
$NepaliDate = NepaliDate($engDate);
|
||||||
|
$nD = explode("-", $NepaliDate);
|
||||||
|
$Day = '1';
|
||||||
|
$Month = ($nD[1] < 10) ? '0' . $nD[1] : $nD[1];
|
||||||
|
$Year = $nD[0];
|
||||||
|
$t = "select ad_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'";
|
||||||
|
return DB::select($t)[0]->ad_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('lastDayOfNepaliMonth')) {
|
||||||
|
function lastDayOfNepaliMonth($engDate = "")
|
||||||
|
{
|
||||||
|
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||||
|
$NepaliDate = NepaliDate1($engDate);
|
||||||
|
$nD = explode("-", $NepaliDate);
|
||||||
|
$Day = '1';
|
||||||
|
$Month = $nD[1];
|
||||||
|
$Year = $nD[0];
|
||||||
|
$t = "select ad_date from tbl_nepengcalendar where bs_date like '" . $Year . "-" . $Month . "-%' order by ad_date";
|
||||||
|
$dates = DB::select($t);
|
||||||
|
$date = end($dates);
|
||||||
|
return $date->ad_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('EnglishDate')) {
|
||||||
|
function EnglishDate($NepaliYear, $NepaliMonth, $NepaliDay)
|
||||||
|
{
|
||||||
|
if ($NepaliMonth < 10) {
|
||||||
|
$NepaliMonth = "0" . $NepaliMonth;
|
||||||
|
}
|
||||||
|
$bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay;
|
||||||
|
$t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'";
|
||||||
|
$q = DB::select($t);
|
||||||
|
return $q[0]->ad_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('Today')) {
|
||||||
|
function Today()
|
||||||
|
{
|
||||||
|
return date("Y-m-d");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('NepaliToEnglishDate')) {
|
||||||
|
function NepaliToEnglishDate($NepaliDate)
|
||||||
|
{
|
||||||
|
$NepaliDate = trim($NepaliDate);
|
||||||
|
if (trim($NepaliDate) == "") {
|
||||||
|
return date("Y-m-d");
|
||||||
|
}
|
||||||
|
$NepaliDate = explode("-", $NepaliDate);
|
||||||
|
$NepaliMonth = intval($NepaliDate[1]);
|
||||||
|
$NepaliYear = intval($NepaliDate[0]);
|
||||||
|
$NepaliDay = intval($NepaliDate[2]);
|
||||||
|
if ($NepaliMonth < 10) {
|
||||||
|
$NepaliMonth = "0" . $NepaliMonth;
|
||||||
|
}
|
||||||
|
$bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay;
|
||||||
|
$t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'";
|
||||||
|
$q = DB::select($t);
|
||||||
|
return $q[0]->ad_date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('NepaliDate')) {
|
||||||
|
function NepaliDate($engDate = "")
|
||||||
|
{
|
||||||
|
$engDate = ($engDate != "") ? $engDate : date("Y-m-d");
|
||||||
|
if ($engDate != "0000-00-00") {
|
||||||
|
// return str_replace("-0", "-", DB::table('tbl_nepengcalendar')->where('ad_date', $engDate)->first()->bs_date);
|
||||||
|
$result = DB::table('tbl_nepengcalendar')->where('ad_date', $engDate)->first();
|
||||||
|
|
||||||
|
if ($result) {
|
||||||
|
$bsDate = $result->bs_date;
|
||||||
|
$convertedDate = convertNumbersToUnicode(str_replace("-", "-", $bsDate));
|
||||||
|
return $convertedDate;
|
||||||
|
} else {
|
||||||
|
// Handle the case when the query result is null
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function convertNumbersToUnicode($number = "2080-10-13")
|
||||||
|
{
|
||||||
|
$unicodeDigits = [
|
||||||
|
'0' => '०',
|
||||||
|
'1' => '१',
|
||||||
|
'2' => '२',
|
||||||
|
'3' => '३',
|
||||||
|
'4' => '४',
|
||||||
|
'5' => '५',
|
||||||
|
'6' => '६',
|
||||||
|
'7' => '७',
|
||||||
|
'8' => '८',
|
||||||
|
'9' => '९',
|
||||||
|
];
|
||||||
|
|
||||||
|
$converted = '';
|
||||||
|
$digits = str_split((string)$number);
|
||||||
|
|
||||||
|
foreach ($digits as $digit) {
|
||||||
|
if (isset($unicodeDigits[$digit])) {
|
||||||
|
$converted .= $unicodeDigits[$digit];
|
||||||
|
} elseif ($digit === '-') {
|
||||||
|
$converted .= '-';
|
||||||
|
} else {
|
||||||
|
$converted .= $digit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//dd($converted);
|
||||||
|
return $converted;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!function_exists('NepaliMonth')) {
|
||||||
|
function NepaliMonth($engDate = "")
|
||||||
|
{
|
||||||
|
$NepaliDate = NepaliDate($engDate);
|
||||||
|
$nD = explode("-", $NepaliDate);
|
||||||
|
$Month = $nD[1];
|
||||||
|
return intval($Month);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('NepaliYear')) {
|
||||||
|
function NepaliYear($engDate = "")
|
||||||
|
{
|
||||||
|
$NepaliDate = NepaliDate($engDate);
|
||||||
|
$nD = explode("-", $NepaliDate);
|
||||||
|
$Year = $nD[0];
|
||||||
|
return intval($Year);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('NepaliMonthNameByNumber')) {
|
||||||
|
function NepaliMonthNameByNumber($number)
|
||||||
|
{
|
||||||
|
$MonthNames = array(
|
||||||
|
"Baisakh", "Jestha", "Ashad", "Shrawan", "Bhadra", "Asoj",
|
||||||
|
"Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"
|
||||||
|
);
|
||||||
|
return $MonthNames[$number - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('NepaliMonthName')) {
|
||||||
|
function NepaliMonthName($engDate = "")
|
||||||
|
{
|
||||||
|
$Month = NepaliMonth($engDate);
|
||||||
|
$MonthNames = array(
|
||||||
|
"Baisakh", "Jestha", "Ashad", "Shrawan", "Bhadra", "Asoj",
|
||||||
|
"Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"
|
||||||
|
);
|
||||||
|
return $MonthNames[$Month - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('N2')) {
|
||||||
|
function N2($N)
|
||||||
|
{
|
||||||
|
return number_format($N, 2, '.', ',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function collectScripts(callable $callback)
|
||||||
|
{
|
||||||
|
ob_start();
|
||||||
|
$callback();
|
||||||
|
$script = ob_get_clean();
|
||||||
|
|
||||||
|
if (!empty($script)) {
|
||||||
|
pushScriptToFooter($script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function pushScriptToFooter($script)
|
||||||
|
{
|
||||||
|
if (!isset($GLOBALS['scripts'])) {
|
||||||
|
$GLOBALS['scripts'] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$GLOBALS['scripts'][] = $script;
|
||||||
|
}
|
||||||
|
function sectionHeader($text, $sectiontitle = null)
|
||||||
|
{
|
||||||
|
$texts=explode(" ",$text);
|
||||||
|
?>
|
||||||
|
<div class="row text-center intro">
|
||||||
|
|
||||||
|
<div class="col-12">
|
||||||
|
<?php if ($sectiontitle) : ?>
|
||||||
|
<span class="pre-title"><?php echo $sectiontitle; ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<h2 class="ylw-clr"><?php echo $texts[0]; unset($texts[0]); ?> <span class="featured"><span><?php echo implode(" ",$texts); ?></span></span></h2>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
if (!function_exists('replace_img_src')) {
|
||||||
|
function replace_img_src($content)
|
||||||
|
{
|
||||||
|
return preg_replace(
|
||||||
|
'/src="storage(\/[^"]*)"/',
|
||||||
|
'src="'.site_url().'storage$1"',
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function processForShortcode($content)
|
||||||
|
{
|
||||||
|
$content=replace_img_src($content);
|
||||||
|
return preg_replace_callback('/\[([\w_]+)([^]]*)\]/', function ($matches) {
|
||||||
|
$shortcodeName = $matches[1];
|
||||||
|
$shortcodeAttributes = [];
|
||||||
|
$mandatoryAttributes = ['alias', 'css', 'title'];
|
||||||
|
|
||||||
|
preg_match_all('/\s*(\w+)\s*=\s*(?:"([^"]*)"|\'([^\']*)\'|([^"\'][^\s]*))/', $matches[2], $attrMatches, PREG_SET_ORDER);
|
||||||
|
|
||||||
|
foreach ($attrMatches as $attrMatch) {
|
||||||
|
$attrName = $attrMatch[1];
|
||||||
|
$attrValue = $attrMatch[2] ?: ($attrMatch[3] ?: $attrMatch[4]); // Use non-empty capture group as the attribute value
|
||||||
|
$attrValue = trim($attrValue, "\"'"); // Remove both single and double quotes from the attribute value
|
||||||
|
$shortcodeAttributes[$attrName] = $attrValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill in missing mandatory attributes with empty strings
|
||||||
|
foreach ($mandatoryAttributes as $attribute) {
|
||||||
|
if (!isset($shortcodeAttributes[$attribute])) {
|
||||||
|
$shortcodeAttributes[$attribute] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return view("shortcodes." . $shortcodeName, $shortcodeAttributes);
|
||||||
|
}, $content);
|
||||||
|
}
|
BIN
app/Http/.DS_Store
vendored
Normal file
BIN
app/Http/.DS_Store
vendored
Normal file
Binary file not shown.
48
app/Http/Controllers/Auth/AuthenticatedSessionController.php
Normal file
48
app/Http/Controllers/Auth/AuthenticatedSessionController.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Http\Requests\Auth\LoginRequest;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AuthenticatedSessionController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the login view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('pages.login');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming authentication request.
|
||||||
|
*/
|
||||||
|
public function store(LoginRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->authenticate();
|
||||||
|
|
||||||
|
$request->session()->regenerate();
|
||||||
|
|
||||||
|
return redirect()->intended(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy an authenticated session.
|
||||||
|
*/
|
||||||
|
public function destroy(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
Auth::guard('web')->logout();
|
||||||
|
|
||||||
|
$request->session()->invalidate();
|
||||||
|
|
||||||
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
|
return redirect('/');
|
||||||
|
}
|
||||||
|
}
|
43
app/Http/Controllers/Auth/ConfirmablePasswordController.php
Normal file
43
app/Http/Controllers/Auth/ConfirmablePasswordController.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class ConfirmablePasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Show the confirm password view.
|
||||||
|
*/
|
||||||
|
public function show(): View
|
||||||
|
{
|
||||||
|
return view('auth.confirm-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirm the user's password.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if (!Auth::guard('web')->validate([
|
||||||
|
'email' => $request->user()->email,
|
||||||
|
'password' => $request->password,
|
||||||
|
])) {
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'password' => __('auth.password'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->session()->put('auth.password_confirmed_at', time());
|
||||||
|
|
||||||
|
return redirect()->intended(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class EmailVerificationNotificationController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Send a new email verification notification.
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
|
||||||
|
$request->user()->sendEmailVerificationNotification();
|
||||||
|
|
||||||
|
return back()->with('status', 'verification-link-sent');
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class EmailVerificationPromptController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the email verification prompt.
|
||||||
|
*/
|
||||||
|
public function __invoke(Request $request): RedirectResponse|View
|
||||||
|
{
|
||||||
|
return $request->user()->hasVerifiedEmail()
|
||||||
|
? redirect()->intended(RouteServiceProvider::HOME)
|
||||||
|
: view('auth.verify-email');
|
||||||
|
}
|
||||||
|
}
|
61
app/Http/Controllers/Auth/NewPasswordController.php
Normal file
61
app/Http/Controllers/Auth/NewPasswordController.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Auth\Events\PasswordReset;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class NewPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset view.
|
||||||
|
*/
|
||||||
|
public function create(Request $request): View
|
||||||
|
{
|
||||||
|
return view('auth.reset-password', ['request' => $request]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming new password request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'token' => ['required'],
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Here we will attempt to reset the user's password. If it is successful we
|
||||||
|
// will update the password on an actual user model and persist it to the
|
||||||
|
// database. Otherwise we will parse the error and return the response.
|
||||||
|
$status = Password::reset(
|
||||||
|
$request->only('email', 'password', 'password_confirmation', 'token'),
|
||||||
|
function ($user) use ($request) {
|
||||||
|
$user->forceFill([
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
'remember_token' => Str::random(60),
|
||||||
|
])->save();
|
||||||
|
|
||||||
|
event(new PasswordReset($user));
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// If the password was successfully reset, we will redirect the user back to
|
||||||
|
// the application's home authenticated view. If there is an error we can
|
||||||
|
// redirect them back to where they came from with their error message.
|
||||||
|
return $status == Password::PASSWORD_RESET
|
||||||
|
? redirect()->route('login')->with('status', __($status))
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => __($status)]);
|
||||||
|
}
|
||||||
|
}
|
31
app/Http/Controllers/Auth/PasswordController.php
Normal file
31
app/Http/Controllers/Auth/PasswordController.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
class PasswordController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Update the user's password.
|
||||||
|
*/
|
||||||
|
public function update(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$validated = $request->validateWithBag('updatePassword', [
|
||||||
|
'current_password' => ['required', 'current_password'],
|
||||||
|
'password' => ['required', Password::defaults(), 'confirmed'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$request->user()->update([
|
||||||
|
'password' => Hash::make($validated['password']),
|
||||||
|
]);
|
||||||
|
|
||||||
|
return back()->with('status', 'password-updated');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
44
app/Http/Controllers/Auth/PasswordResetLinkController.php
Normal file
44
app/Http/Controllers/Auth/PasswordResetLinkController.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Password;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class PasswordResetLinkController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the password reset link request view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.forgot-password');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming password reset link request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'email' => ['required', 'email'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
// We will send the password reset link to this user. Once we have attempted
|
||||||
|
// to send the link, we will examine the response then see the message we
|
||||||
|
// need to show to the user. Finally, we'll send out a proper response.
|
||||||
|
$status = Password::sendResetLink(
|
||||||
|
$request->only('email')
|
||||||
|
);
|
||||||
|
|
||||||
|
return $status == Password::RESET_LINK_SENT
|
||||||
|
? back()->with('status', __($status))
|
||||||
|
: back()->withInput($request->only('email'))
|
||||||
|
->withErrors(['email' => __($status)]);
|
||||||
|
}
|
||||||
|
}
|
52
app/Http/Controllers/Auth/RegisteredUserController.php
Normal file
52
app/Http/Controllers/Auth/RegisteredUserController.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\User;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Validation\Rules;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class RegisteredUserController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the registration view.
|
||||||
|
*/
|
||||||
|
public function create(): View
|
||||||
|
{
|
||||||
|
return view('auth.register');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle an incoming registration request.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function store(Request $request): RedirectResponse
|
||||||
|
{
|
||||||
|
$request->validate([
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:' . User::class],
|
||||||
|
'password' => ['required', 'confirmed', Rules\Password::defaults()],
|
||||||
|
]);
|
||||||
|
$request->merge(["username" => $request->email]);
|
||||||
|
$user = User::create([
|
||||||
|
'name' => $request->name,
|
||||||
|
'email' => $request->email,
|
||||||
|
'username' => $request->email,
|
||||||
|
'password' => Hash::make($request->password),
|
||||||
|
]);
|
||||||
|
|
||||||
|
event(new Registered($user));
|
||||||
|
|
||||||
|
Auth::login($user);
|
||||||
|
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
}
|
28
app/Http/Controllers/Auth/VerifyEmailController.php
Normal file
28
app/Http/Controllers/Auth/VerifyEmailController.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Auth\Events\Verified;
|
||||||
|
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
|
||||||
|
class VerifyEmailController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Mark the authenticated user's email address as verified.
|
||||||
|
*/
|
||||||
|
public function __invoke(EmailVerificationRequest $request): RedirectResponse
|
||||||
|
{
|
||||||
|
if ($request->user()->hasVerifiedEmail()) {
|
||||||
|
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->user()->markEmailAsVerified()) {
|
||||||
|
event(new Verified($request->user()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->intended(RouteServiceProvider::HOME.'?verified=1');
|
||||||
|
}
|
||||||
|
}
|
12
app/Http/Controllers/Controller.php
Normal file
12
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
|
class Controller extends BaseController
|
||||||
|
{
|
||||||
|
use AuthorizesRequests, ValidatesRequests;
|
||||||
|
}
|
20
app/Http/Controllers/FileController.php
Normal file
20
app/Http/Controllers/FileController.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class FileController extends Controller
|
||||||
|
{
|
||||||
|
public function upload(Request $request)
|
||||||
|
{
|
||||||
|
$file = $request->file('upload');
|
||||||
|
$filename = uniqid() . '_' . $file->getClientOriginalName();
|
||||||
|
Storage::disk('public')->put($filename, file_get_contents($file));
|
||||||
|
$url = asset('storage/' . $filename);
|
||||||
|
return response()->json([
|
||||||
|
'url' => $url,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
374
app/Http/Controllers/FormsController.php
Normal file
374
app/Http/Controllers/FormsController.php
Normal file
@ -0,0 +1,374 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Mail\CustomMailer;
|
||||||
|
use App\Models\Enquiries;
|
||||||
|
use App\Models\Forms;
|
||||||
|
use App\Models\Formsubmissions;
|
||||||
|
use App\Models\Settings;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Http;
|
||||||
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class FormsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
public function __construct(Forms $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'index', ' Forms index');
|
||||||
|
$data = Forms::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
return view("crud.generated.forms.index", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'create', ' Forms create');
|
||||||
|
$TableData = Forms::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.forms.create", compact('TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'store', ' Forms store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_forms')]);
|
||||||
|
$requestData = $request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
// dd($requestData);
|
||||||
|
$fieldNames = $_POST['fieldNames'];
|
||||||
|
$fieldTypes = $_POST['fieldTypes'];
|
||||||
|
$fieldDefaults = $_POST['fieldDefaults'];
|
||||||
|
$fieldCss = $_POST['fieldCss'];
|
||||||
|
|
||||||
|
$fieldData = [];
|
||||||
|
|
||||||
|
// Loop through the arrays and create an associative array for each field
|
||||||
|
for ($i = 0; $i < count($fieldNames); $i++) {
|
||||||
|
$fieldData[] = [
|
||||||
|
'fieldName' => $fieldNames[$i],
|
||||||
|
'fieldType' => $fieldTypes[$i],
|
||||||
|
'fieldDefault' => $fieldDefaults[$i],
|
||||||
|
'fieldCss' => $fieldCss[$i],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the field data array to JSON string
|
||||||
|
$requestData["form_fields"] = json_encode($fieldData);
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Forms Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('forms.index')->with('success', 'The Forms created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Forms::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Forms::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'show', ' Forms show');
|
||||||
|
$data = Forms::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.forms.show", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'edit', ' Forms edit');
|
||||||
|
$TableData = Forms::where('status', '<>', -1)->orderBy('display_order')->get();
|
||||||
|
$data = Forms::findOrFail($id);
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$html = view("crud.generated.forms.ajax.edit", compact('data'))->render();
|
||||||
|
return response()->json(['status' => true, 'content' => $html], 200);
|
||||||
|
}
|
||||||
|
return view("crud.generated.forms.edit", compact('data', 'TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'update', ' Forms update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
$requestData = $request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
$fieldNames = $_POST['fieldNames'];
|
||||||
|
$fieldTypes = $_POST['fieldTypes'];
|
||||||
|
$fieldDefaults = $_POST['fieldDefaults'];
|
||||||
|
$fieldCss = $_POST['fieldCss'];
|
||||||
|
|
||||||
|
$fieldData = [];
|
||||||
|
|
||||||
|
// Loop through the arrays and create an associative array for each field
|
||||||
|
for ($i = 0; $i < count($fieldNames); $i++) {
|
||||||
|
$fieldData[] = [
|
||||||
|
'fieldName' => $fieldNames[$i],
|
||||||
|
'fieldAlias' => slugify($fieldNames[$i]),
|
||||||
|
'fieldType' => $fieldTypes[$i],
|
||||||
|
'fieldDefault' => $fieldDefaults[$i],
|
||||||
|
'fieldCss' => $fieldCss[$i],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert the field data array to JSON string
|
||||||
|
$requestData["form_fields"] = json_encode($fieldData);
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('form_id'));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(FormsController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Forms updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
// return redirect()->route('forms.index')->with('success','The Forms updated Successfully.');
|
||||||
|
return redirect()->back()->with('success', 'The Forms updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsController::class, 'destroy', ' Forms destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(FormsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Forms Deleted Successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function submitenquiry(Request $r)
|
||||||
|
// {
|
||||||
|
// // dd($r->all());
|
||||||
|
// $validator = Validator::make($r->all(), [
|
||||||
|
// 'g-recaptcha-response' => 'required',
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// if ($validator->fails()) {
|
||||||
|
// return redirect()
|
||||||
|
// ->route('register')
|
||||||
|
// ->withErrors($validator)
|
||||||
|
// ->withInput();
|
||||||
|
// }
|
||||||
|
// $r = $r->all();
|
||||||
|
// $captcha = $r['g-recaptcha-response'];
|
||||||
|
// // dd($captcha);
|
||||||
|
|
||||||
|
// $response = Http::get("https://www.google.com/recaptcha/api/siteverify", [
|
||||||
|
// 'secret' => env('RECAPTCHA_SECRET_KEY'),
|
||||||
|
// 'secret' => SITEVARS->recaptcha_secret_key,
|
||||||
|
// 'response' => $captcha,
|
||||||
|
// ]);
|
||||||
|
// $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . env("RECAPTCHA_SECRET_KEY") . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']), true);
|
||||||
|
// dd($response);
|
||||||
|
|
||||||
|
// $response = $response->json(); //['success'];
|
||||||
|
// if ($response['success'] == false) {
|
||||||
|
// return response()->json(['success' => false, 'message' => 'Captcha Validation Error. Refresh and submit the form again']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $FormData = array(
|
||||||
|
// "name" => isset($r['name']) ? $r['name'] : "",
|
||||||
|
// "email" => isset($r['email']) ? $r['email'] : "",
|
||||||
|
// "phone" => isset($r['phone']) ? $r['phone'] : "",
|
||||||
|
// "preparationclassoffers_id" => isset($r['preparationclassoffers_id']) ? $r['preparationclassoffers_id'] : "",
|
||||||
|
// );
|
||||||
|
|
||||||
|
// dd($FormData);
|
||||||
|
|
||||||
|
// DB::table('enquiries')->insert($FormData);
|
||||||
|
// $mailer = new CustomMailer($FormData);
|
||||||
|
// Mail::to("deepakstha123321@gmail.com")->send($mailer->enquiryform());
|
||||||
|
// if (!empty(SITEVARS->email)) {
|
||||||
|
// Mail::to(SITEVARS->email)->send($mailer->enquiryform());
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Mail::to($r['email'])->send($mailer->enquiryresponse());
|
||||||
|
|
||||||
|
// // Respond back to the customer
|
||||||
|
// return response()->json(['success' => true, 'message' => 'Form submitted successfully!']);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function submitEnquiry(Request $r)
|
||||||
|
{
|
||||||
|
$validator = Validator::make($r->all(), [
|
||||||
|
'name' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'phone' => 'required',
|
||||||
|
'preparationclassoffers_id' => 'required_if:enquiry_type,class',
|
||||||
|
'message' => 'required_if:enquiry_type,contact',
|
||||||
|
'g-recaptcha-response' => 'required',
|
||||||
|
'agree' => 'required',
|
||||||
|
], [
|
||||||
|
'name' => 'Name is required.',
|
||||||
|
'preparationclassoffers_id' => 'Select at least one classs.',
|
||||||
|
'g-recaptcha-response.required' => 'Please complete the security verification.',
|
||||||
|
'email.required' => 'Email is required.',
|
||||||
|
'email.email' => 'Must be a valid email address.',
|
||||||
|
'phone.required' => 'Phone number is required.',
|
||||||
|
'agree.required' => 'You must agree to the terms and conditions.',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json($validator->errors(), 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$setting = Settings::where('status', 1)->first();
|
||||||
|
|
||||||
|
// Validate reCAPTCHA response
|
||||||
|
$captcha = $r['g-recaptcha-response'];
|
||||||
|
$response = Http::get("https://www.google.com/recaptcha/api/siteverify", [
|
||||||
|
'secret' => $setting->recaptcha_secret_key,
|
||||||
|
'response' => $captcha,
|
||||||
|
]);
|
||||||
|
$responseData = $response->json();
|
||||||
|
|
||||||
|
if (!$responseData['success']) {
|
||||||
|
return response()->json(['error' => false, 'message' => 'Captcha validation failed'], 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$FormData = [
|
||||||
|
"name" => $r->input('name'),
|
||||||
|
"email" => $r->input('email'),
|
||||||
|
"phone" => $r->input('phone'),
|
||||||
|
"enquiry_type" => $r->input('enquiry_type'),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($r->enquiry_type == "contact") {
|
||||||
|
$FormData['message'] = $r->input('message');
|
||||||
|
} else {
|
||||||
|
$FormData['preparationclassoffers_id'] = $r->input('preparationclassoffers_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
Enquiries::create($FormData);
|
||||||
|
|
||||||
|
$mailer = new CustomMailer($FormData);
|
||||||
|
if (!empty(SITEVARS->email)) {
|
||||||
|
Mail::to(SITEVARS->email)->send($mailer->enquiryform());
|
||||||
|
} else {
|
||||||
|
Mail::to("info@access-skills.com")->send($mailer->enquiryform());
|
||||||
|
}
|
||||||
|
|
||||||
|
Mail::to($r['email'])->send($mailer->enquiryresponse());
|
||||||
|
|
||||||
|
return response()->json(['success' => true, 'message' => 'Your registeration form submitted successfully']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handleFormSubmission(Request $r)
|
||||||
|
{
|
||||||
|
$r = $r->all();
|
||||||
|
$FormID = $r['form_id'];
|
||||||
|
$FormFields = Forms::where("form_id", $FormID)->pluck('form_fields')[0];
|
||||||
|
$tableName = 'formsubmissions';
|
||||||
|
if (!Schema::hasTable($tableName)) {
|
||||||
|
Schema::create($tableName, function (Blueprint $table) {
|
||||||
|
$table->increments('formsubmission_id');
|
||||||
|
$table->integer('forms_id')->unsigned();
|
||||||
|
$table->json('submitted_values');
|
||||||
|
$table->integer('display_order')->default(0);
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->timestamps();
|
||||||
|
$table->integer('createdby')->nullable();
|
||||||
|
$table->integer('updatedby')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$FormFields = json_decode($FormFields);
|
||||||
|
$FilledForm = array();
|
||||||
|
foreach ($FormFields as $FormField) {
|
||||||
|
$fieldData = new \stdClass;
|
||||||
|
$fieldData->fieldName = $FormField->fieldName;
|
||||||
|
$fieldData->fieldType = $FormField->fieldType;
|
||||||
|
$fieldData->fieldValue = isset($r[strtolower($FormField->fieldAlias)]) ? $r[strtolower($FormField->fieldAlias)] : "";
|
||||||
|
$FilledForm[] = $fieldData;
|
||||||
|
}
|
||||||
|
$FilledForm = json_encode($FilledForm);
|
||||||
|
$formSubmission = new FormSubmissions();
|
||||||
|
$formSubmission->forms_id = $FormID;
|
||||||
|
$formSubmission->submitted_values = $FilledForm;
|
||||||
|
$formSubmission->save();
|
||||||
|
return redirect()->back()->with('success', 'Form submitted successfully!');
|
||||||
|
}
|
||||||
|
}
|
180
app/Http/Controllers/FormsubmissionsController.php
Normal file
180
app/Http/Controllers/FormsubmissionsController.php
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Formsubmissions;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Log;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class FormsubmissionsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
public function __construct(Formsubmissions $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'index', ' Formsubmissions index');
|
||||||
|
$data = Formsubmissions::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
return view("crud.generated.formsubmissions.index", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'create', ' Formsubmissions create');
|
||||||
|
$TableData = Formsubmissions::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.formsubmissions.create",compact('TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'store', ' Formsubmissions store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_formsubmissions')]);
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(FormsubmissionsController::class, 'store', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Formsubmissions Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('formsubmissions.index')->with('success','The Formsubmissions created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Formsubmissions::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Formsubmissions::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'show', ' Formsubmissions show');
|
||||||
|
$data = Formsubmissions::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.formsubmissions.show", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'edit', ' Formsubmissions edit');
|
||||||
|
$TableData = Formsubmissions::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
$data = Formsubmissions::findOrFail($id);
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$html = view("crud.generated.formsubmissions.ajax.edit", compact('data'))->render();
|
||||||
|
return response()->json(['status' => true, 'content' => $html], 200);
|
||||||
|
}
|
||||||
|
return view("crud.generated.formsubmissions.edit", compact('data','TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'update', ' Formsubmissions update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('formsubmission_id'));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(FormsubmissionsController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Formsubmissions updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
// return redirect()->route('formsubmissions.index')->with('success','The Formsubmissions updated Successfully.');
|
||||||
|
return redirect()->back()->with('success', 'The Formsubmissions updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request,$id)
|
||||||
|
{
|
||||||
|
createActivityLog(FormsubmissionsController::class, 'destroy', ' Formsubmissions destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(FormsubmissionsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status'=>true,'message'=>'The Formsubmissions Deleted Successfully.'],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
1284
app/Http/Controllers/GeneralFormController.php
Normal file
1284
app/Http/Controllers/GeneralFormController.php
Normal file
File diff suppressed because it is too large
Load Diff
237
app/Http/Controllers/MenuitemsController.php
Normal file
237
app/Http/Controllers/MenuitemsController.php
Normal file
@ -0,0 +1,237 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Menuitems;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Exception;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Log;
|
||||||
|
|
||||||
|
class MenuitemsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
protected static $menuTypes;
|
||||||
|
public function __construct(Menuitems $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
self::initializeController();
|
||||||
|
}
|
||||||
|
public function initializeController()
|
||||||
|
{
|
||||||
|
$menuTypes = [
|
||||||
|
['display' => "Articles", 'value' => "tbl_articles"],
|
||||||
|
['display' => "Country", 'value' => "tbl_countries"],
|
||||||
|
['display' => "Country Articles", 'value' => "tbl_countryarticles"],
|
||||||
|
['display' => "Events", 'value' => "tbl_events"],
|
||||||
|
['display' => "Faqs", 'value' => "tbl_faqs"],
|
||||||
|
['display' => "Institutions", 'value' => "tbl_institutions"],
|
||||||
|
['display' => "News/Blogs", 'value' => "tbl_news"],
|
||||||
|
['display' => "Preparation class", 'value' => "tbl_preparationclasses"],
|
||||||
|
['display' => "Testimonial", 'value' => "tbl_testimonials"],
|
||||||
|
|
||||||
|
['display' => "Custom", 'value' => ""],
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($menuTypes as &$menuType) {
|
||||||
|
switch ($menuType['value']) {
|
||||||
|
case 'tbl_articles':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select article_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_countries':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select country_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_countryarticles':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select article_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_events':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select event_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_faqs':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select faq_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_institutions':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select institution_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_news':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select news_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_preparationclasses':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select preparationclass_id as value,title as display from " . $menuType['value'] . " where status=1 Order by title"));
|
||||||
|
break;
|
||||||
|
case 'tbl_testimonials':
|
||||||
|
$menuType['values'] = json_encode(DB::select("select testimonial_id as value, `by` as display from " . $menuType['value'] . " where status=1 order by `by`"));
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
$menuType['values'] = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$menuTypes = $menuTypes;
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'index', ' Menuitems index');
|
||||||
|
$data = Menuitems::where('status', '<>', -1);
|
||||||
|
$menulocation = $request->query("menulocation");
|
||||||
|
if (null != $menulocation) {
|
||||||
|
$data = $data->where('menulocations_id', $menulocation);
|
||||||
|
}
|
||||||
|
$data = $data->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.menuitems.index", compact('data', 'menulocation'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'create', ' Menuitems create');
|
||||||
|
$TableData = Menuitems::where('status', '<>', -1);
|
||||||
|
$menulocation = $request->query("menulocation");
|
||||||
|
if (null != $menulocation) {
|
||||||
|
$TableData = $TableData->where('menulocations_id', $menulocation);
|
||||||
|
}
|
||||||
|
$TableData = $TableData->orderBy('display_order')->get();
|
||||||
|
$menuTypes = self::$menuTypes;
|
||||||
|
return view("crud.generated.menuitems.create", compact('TableData', 'menuTypes', 'menulocation'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'store', ' Menuitems store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_menuitems')]);
|
||||||
|
$requestData = $request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenuitemsController::class, 'store', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Menuitems Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->back()->with('success', 'The Menuitems Added successfully.');
|
||||||
|
// return redirect()->route('menuitems.index')->with('success', 'The Menuitems created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Menuitems::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Menuitems::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'show', ' Menuitems show');
|
||||||
|
$data = Menuitems::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.menuitems.show", compact('data'));
|
||||||
|
}
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'edit', ' Menuitems edit');
|
||||||
|
$TableData = Menuitems::where('status', '<>', -1);
|
||||||
|
$menulocation = $request->query("menulocation");
|
||||||
|
if (null != $menulocation) {
|
||||||
|
$TableData = $TableData->where('menulocations_id', $menulocation);
|
||||||
|
}
|
||||||
|
$TableData = $TableData->orderBy('display_order')->get();
|
||||||
|
$menuTypes = self::$menuTypes;
|
||||||
|
$data = Menuitems::findOrFail($id);
|
||||||
|
return view("crud.generated.menuitems.edit", compact('data', 'TableData', 'menulocation', 'menuTypes'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'update', ' Menuitems update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
], 500);
|
||||||
|
}
|
||||||
|
$requestData = $request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL') . '/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
// dd($requestData);
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenuitemsController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Menuitems updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('menuitems.index')->with('success', 'The Menuitems updated Successfully.');
|
||||||
|
// return redirect()->back()->with('success', 'The Menuitems updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenuitemsController::class, 'destroy', ' Menuitems destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenuitemsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Menuitems Deleted Successfully.'], 200);
|
||||||
|
}
|
||||||
|
}
|
180
app/Http/Controllers/MenulocationsController.php
Normal file
180
app/Http/Controllers/MenulocationsController.php
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Menulocations;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Log;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class MenulocationsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
public function __construct(Menulocations $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'index', ' Menulocations index');
|
||||||
|
$data = Menulocations::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
return view("crud.generated.menulocations.index", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'create', ' Menulocations create');
|
||||||
|
$TableData = Menulocations::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.menulocations.create",compact('TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'store', ' Menulocations store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_menulocations')]);
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenulocationsController::class, 'store', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Menulocations Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('menulocations.index')->with('success','The Menulocations created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Menulocations::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Menulocations::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'show', ' Menulocations show');
|
||||||
|
$data = Menulocations::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.menulocations.show", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'edit', ' Menulocations edit');
|
||||||
|
$TableData = Menulocations::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
$data = Menulocations::findOrFail($id);
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$html = view("crud.generated.menulocations.ajax.edit", compact('data'))->render();
|
||||||
|
return response()->json(['status' => true, 'content' => $html], 200);
|
||||||
|
}
|
||||||
|
return view("crud.generated.menulocations.edit", compact('data','TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'update', ' Menulocations update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('menulocation_id'));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenulocationsController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Menulocations updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
// return redirect()->route('menulocations.index')->with('success','The Menulocations updated Successfully.');
|
||||||
|
return redirect()->back()->with('success', 'The Menulocations updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request,$id)
|
||||||
|
{
|
||||||
|
createActivityLog(MenulocationsController::class, 'destroy', ' Menulocations destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(MenulocationsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status'=>true,'message'=>'The Menulocations Deleted Successfully.'],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
198
app/Http/Controllers/SettingsController.php
Normal file
198
app/Http/Controllers/SettingsController.php
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Settings;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Log;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class SettingsController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
public function __construct(Settings $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'index', ' Settings index');
|
||||||
|
$data = Settings::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
return view("crud.generated.settings.index", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'create', ' Settings create');
|
||||||
|
$TableData = Settings::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.settings.create",compact('TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'store', ' Settings store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_settings')]);
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(SettingsController::class, 'store', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Settings Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('settings.index')->with('success','The Settings created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Settings::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Settings::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'show', ' Settings show');
|
||||||
|
$data = Settings::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.settings.show", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'edit', ' Settings edit');
|
||||||
|
$TableData = Settings::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
$data = Settings::findOrFail($id);
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$html = view("crud.generated.settings.ajax.edit", compact('data'))->render();
|
||||||
|
return response()->json(['status' => true, 'content' => $html], 200);
|
||||||
|
}
|
||||||
|
return view("crud.generated.settings.edit", compact('data','TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'update', ' Settings update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('setting_id'));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(SettingsController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Settings updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
// return redirect()->route('settings.index')->with('success','The Settings updated Successfully.');
|
||||||
|
return redirect()->back()->with('success', 'The Settings updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request,$id)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'destroy', ' Settings destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(SettingsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status'=>true,'message'=>'The Settings Deleted Successfully.'],200);
|
||||||
|
}
|
||||||
|
public function toggle(Request $request,$id)
|
||||||
|
{
|
||||||
|
createActivityLog(SettingsController::class, 'destroy', ' Settings destroy');
|
||||||
|
$data = Settings::findOrFail($id);
|
||||||
|
$requestData=['status'=>($data->status==1)?0:1];
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(SettingsController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status'=>true,'message'=>'The Settings Deleted Successfully.'],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
180
app/Http/Controllers/ShortcodesController.php
Normal file
180
app/Http/Controllers/ShortcodesController.php
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\Shortcodes;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use App\Service\CommonModelService;
|
||||||
|
use Log;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class ShortcodesController extends Controller
|
||||||
|
{
|
||||||
|
protected $modelService;
|
||||||
|
public function __construct(Shortcodes $model)
|
||||||
|
{
|
||||||
|
$this->modelService = new CommonModelService($model);
|
||||||
|
}
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'index', ' Shortcodes index');
|
||||||
|
$data = Shortcodes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
return view("crud.generated.shortcodes.index", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'create', ' Shortcodes create');
|
||||||
|
$TableData = Shortcodes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
return view("crud.generated.shortcodes.create",compact('TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'store', ' Shortcodes store');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD REQUIRED FIELDS FOR VALIDATION
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$request->request->add(['alias' => slugify($request->title)]);
|
||||||
|
$request->request->add(['display_order' => getDisplayOrder('tbl_shortcodes')]);
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$operationNumber = getOperationNumber();
|
||||||
|
$this->modelService->create($operationNumber, $operationNumber, null, $requestData);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(ShortcodesController::class, 'store', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Shortcodes Created Successfully.'], 200);
|
||||||
|
}
|
||||||
|
return redirect()->route('shortcodes.index')->with('success','The Shortcodes created Successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$idOrder = $request->input('id_order');
|
||||||
|
|
||||||
|
foreach ($idOrder as $index => $id) {
|
||||||
|
$companyArticle = Shortcodes::find($id);
|
||||||
|
$companyArticle->display_order = $index + 1;
|
||||||
|
$companyArticle->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json(['status' => true, 'content' => 'The articles sorted successfully.'], 200);
|
||||||
|
}
|
||||||
|
public function updatealias(Request $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
$articleId = $request->input('articleId');
|
||||||
|
$newAlias = $request->input('newAlias');
|
||||||
|
$companyArticle = Shortcodes::find($articleId);
|
||||||
|
if (!$companyArticle) {
|
||||||
|
return response()->json(['status' => false, 'content' => 'Company article not found.'], 404);
|
||||||
|
}
|
||||||
|
$companyArticle->alias = $newAlias;
|
||||||
|
$companyArticle->save();
|
||||||
|
return response()->json(['status' => true, 'content' => 'Alias updated successfully.'], 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function show(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'show', ' Shortcodes show');
|
||||||
|
$data = Shortcodes::findOrFail($id);
|
||||||
|
|
||||||
|
return view("crud.generated.shortcodes.show", compact('data'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function edit(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'edit', ' Shortcodes edit');
|
||||||
|
$TableData = Shortcodes::where('status','<>',-1)->orderBy('display_order')->get();
|
||||||
|
$data = Shortcodes::findOrFail($id);
|
||||||
|
if ($request->ajax()) {
|
||||||
|
$html = view("crud.generated.shortcodes.ajax.edit", compact('data'))->render();
|
||||||
|
return response()->json(['status' => true, 'content' => $html], 200);
|
||||||
|
}
|
||||||
|
return view("crud.generated.shortcodes.edit", compact('data','TableData'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'update', ' Shortcodes update');
|
||||||
|
$validator = Validator::make($request->all(), [
|
||||||
|
//ADD VALIDATION FOR REQIRED FIELDS
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => $validator->errors(),
|
||||||
|
],500);
|
||||||
|
}
|
||||||
|
$requestData=$request->all();
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL').'/', '', $value);
|
||||||
|
});
|
||||||
|
array_walk_recursive($requestData, function (&$value) {
|
||||||
|
$value = str_replace(env('APP_URL'), '', $value);
|
||||||
|
});
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->update($OperationNumber, $OperationNumber, null, $requestData, $request->input('shortcode_id'));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(ShortcodesController::class, 'update', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
if ($request->ajax()) {
|
||||||
|
return response()->json(['status' => true, 'message' => 'The Shortcodes updated Successfully.'], 200);
|
||||||
|
}
|
||||||
|
// return redirect()->route('shortcodes.index')->with('success','The Shortcodes updated Successfully.');
|
||||||
|
return redirect()->back()->with('success', 'The Shortcodes updated successfully.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy(Request $request,$id)
|
||||||
|
{
|
||||||
|
createActivityLog(ShortcodesController::class, 'destroy', ' Shortcodes destroy');
|
||||||
|
DB::beginTransaction();
|
||||||
|
try {
|
||||||
|
$OperationNumber = getOperationNumber();
|
||||||
|
$this->modelService->destroy($OperationNumber, $OperationNumber, $id);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
Log::info($e->getMessage());
|
||||||
|
createErrorLog(ShortcodesController::class, 'destroy', $e->getMessage());
|
||||||
|
return response()->json(['status' => false, 'message' => $e->getMessage()], 500);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return response()->json(['status'=>true,'message'=>'The Shortcodes Deleted Successfully.'],200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
18
app/Http/Controllers/WebsiteController.php
Normal file
18
app/Http/Controllers/WebsiteController.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
class WebsiteController extends Controller
|
||||||
|
{
|
||||||
|
private $path;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->path = config('app.client_path');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function home(){
|
||||||
|
// return view($this->path.'home');
|
||||||
|
return ('home');
|
||||||
|
}
|
||||||
|
}
|
68
app/Http/Kernel.php
Normal file
68
app/Http/Kernel.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||||
|
|
||||||
|
class Kernel extends HttpKernel
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The application's global HTTP middleware stack.
|
||||||
|
*
|
||||||
|
* These middleware are run during every request to your application.
|
||||||
|
*
|
||||||
|
* @var array<int, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middleware = [
|
||||||
|
// \App\Http\Middleware\TrustHosts::class,
|
||||||
|
\App\Http\Middleware\TrustProxies::class,
|
||||||
|
\Illuminate\Http\Middleware\HandleCors::class,
|
||||||
|
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||||
|
\App\Http\Middleware\TrimStrings::class,
|
||||||
|
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's route middleware groups.
|
||||||
|
*
|
||||||
|
* @var array<string, array<int, class-string|string>>
|
||||||
|
*/
|
||||||
|
protected $middlewareGroups = [
|
||||||
|
'web' => [
|
||||||
|
\App\Http\Middleware\EncryptCookies::class,
|
||||||
|
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||||
|
\Illuminate\Session\Middleware\StartSession::class,
|
||||||
|
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||||
|
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'api' => [
|
||||||
|
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||||
|
\Illuminate\Routing\Middleware\ThrottleRequests::class.':api',
|
||||||
|
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The application's middleware aliases.
|
||||||
|
*
|
||||||
|
* Aliases may be used instead of class names to conveniently assign middleware to routes and groups.
|
||||||
|
*
|
||||||
|
* @var array<string, class-string|string>
|
||||||
|
*/
|
||||||
|
protected $middlewareAliases = [
|
||||||
|
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||||
|
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||||
|
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||||
|
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||||
|
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||||
|
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||||
|
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||||
|
'precognitive' => \Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
|
||||||
|
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||||
|
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||||
|
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||||
|
];
|
||||||
|
}
|
17
app/Http/Middleware/Authenticate.php
Normal file
17
app/Http/Middleware/Authenticate.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class Authenticate extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the path the user should be redirected to when they are not authenticated.
|
||||||
|
*/
|
||||||
|
protected function redirectTo(Request $request): ?string
|
||||||
|
{
|
||||||
|
return $request->expectsJson() ? null : route('login');
|
||||||
|
}
|
||||||
|
}
|
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||||
|
|
||||||
|
class EncryptCookies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the cookies that should not be encrypted.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||||
|
|
||||||
|
class PreventRequestsDuringMaintenance extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be reachable while maintenance mode is enabled.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
30
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class RedirectIfAuthenticated
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next, string ...$guards): Response
|
||||||
|
{
|
||||||
|
$guards = empty($guards) ? [null] : $guards;
|
||||||
|
|
||||||
|
foreach ($guards as $guard) {
|
||||||
|
if (Auth::guard($guard)->check()) {
|
||||||
|
return redirect(RouteServiceProvider::HOME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||||
|
|
||||||
|
class TrimStrings extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the attributes that should not be trimmed.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
'current_password',
|
||||||
|
'password',
|
||||||
|
'password_confirmation',
|
||||||
|
];
|
||||||
|
}
|
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||||
|
|
||||||
|
class TrustHosts extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the host patterns that should be trusted.
|
||||||
|
*
|
||||||
|
* @return array<int, string|null>
|
||||||
|
*/
|
||||||
|
public function hosts(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
$this->allSubdomainsOfApplicationUrl(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class TrustProxies extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trusted proxies for this application.
|
||||||
|
*
|
||||||
|
* @var array<int, string>|string|null
|
||||||
|
*/
|
||||||
|
protected $proxies;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The headers that should be used to detect proxies.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
|
protected $headers =
|
||||||
|
Request::HEADER_X_FORWARDED_FOR |
|
||||||
|
Request::HEADER_X_FORWARDED_HOST |
|
||||||
|
Request::HEADER_X_FORWARDED_PORT |
|
||||||
|
Request::HEADER_X_FORWARDED_PROTO |
|
||||||
|
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||||
|
}
|
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||||
|
|
||||||
|
class ValidateSignature extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The names of the query string parameters that should be ignored.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
// 'fbclid',
|
||||||
|
// 'utm_campaign',
|
||||||
|
// 'utm_content',
|
||||||
|
// 'utm_medium',
|
||||||
|
// 'utm_source',
|
||||||
|
// 'utm_term',
|
||||||
|
];
|
||||||
|
}
|
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||||
|
|
||||||
|
class VerifyCsrfToken extends Middleware
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The URIs that should be excluded from CSRF verification.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $except = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
85
app/Http/Requests/Auth/LoginRequest.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests\Auth;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Lockout;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Illuminate\Validation\ValidationException;
|
||||||
|
|
||||||
|
class LoginRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine if the user is authorized to make this request.
|
||||||
|
*/
|
||||||
|
public function authorize(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'email' => ['required', 'string', 'email'],
|
||||||
|
'password' => ['required', 'string'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attempt to authenticate the request's credentials.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function authenticate(): void
|
||||||
|
{
|
||||||
|
$this->ensureIsNotRateLimited();
|
||||||
|
|
||||||
|
if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
|
||||||
|
RateLimiter::hit($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.failed'),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
RateLimiter::clear($this->throttleKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensure the login request is not rate limited.
|
||||||
|
*
|
||||||
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
|
*/
|
||||||
|
public function ensureIsNotRateLimited(): void
|
||||||
|
{
|
||||||
|
if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event(new Lockout($this));
|
||||||
|
|
||||||
|
$seconds = RateLimiter::availableIn($this->throttleKey());
|
||||||
|
|
||||||
|
throw ValidationException::withMessages([
|
||||||
|
'email' => trans('auth.throttle', [
|
||||||
|
'seconds' => $seconds,
|
||||||
|
'minutes' => ceil($seconds / 60),
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the rate limiting throttle key for the request.
|
||||||
|
*/
|
||||||
|
public function throttleKey(): string
|
||||||
|
{
|
||||||
|
return Str::transliterate(Str::lower($this->input('email')).'|'.$this->ip());
|
||||||
|
}
|
||||||
|
}
|
23
app/Http/Requests/ProfileUpdateRequest.php
Normal file
23
app/Http/Requests/ProfileUpdateRequest.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
|
class ProfileUpdateRequest extends FormRequest
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the validation rules that apply to the request.
|
||||||
|
*
|
||||||
|
* @return array<string, \Illuminate\Contracts\Validation\Rule|array|string>
|
||||||
|
*/
|
||||||
|
public function rules(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => ['string', 'max:255'],
|
||||||
|
'email' => ['email', 'max:255', Rule::unique(User::class)->ignore($this->user()->id)],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
46
app/Mail/CustomMailer.php
Normal file
46
app/Mail/CustomMailer.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class CustomMailer extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $formData;
|
||||||
|
|
||||||
|
public function __construct($formData)
|
||||||
|
{
|
||||||
|
$this->formData = $formData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enquiryform()
|
||||||
|
{
|
||||||
|
$viewPath = 'accessskills.emails.enquiry-submitted';
|
||||||
|
|
||||||
|
if (view()->exists($viewPath)) {
|
||||||
|
return $this->subject('Received a new online enquiry from our website.')
|
||||||
|
->markdown($viewPath, $this->formData);
|
||||||
|
} else {
|
||||||
|
return $this->subject('Received a new online enquiry from our website.')
|
||||||
|
->view('emails.enquiry-submitted', $this->formData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enquiryresponse()
|
||||||
|
{
|
||||||
|
$viewPath = 'accessskills.emails.enquiry-response';
|
||||||
|
|
||||||
|
if (view()->exists($viewPath)) {
|
||||||
|
return $this->subject('Thank you from ' . env('APP_NAME'))
|
||||||
|
->markdown($viewPath, $this->formData);
|
||||||
|
} else {
|
||||||
|
return $this->subject('Thank you from ' . env('APP_NAME'))
|
||||||
|
->view('emails.enquiry-response', $this->formData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
54
app/Mail/Registration.php
Normal file
54
app/Mail/Registration.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class Registration extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $details;
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct($details)
|
||||||
|
{
|
||||||
|
$this->details = $details;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Registration',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'ved.email.registration',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
27
app/Models/Enquiries.php
Normal file
27
app/Models/Enquiries.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Enquiries extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $primaryKey = 'enquiry_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'phone',
|
||||||
|
'email',
|
||||||
|
'enquiry_type',
|
||||||
|
'message',
|
||||||
|
'preparationclassoffers_id',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function class ()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Preparationclassoffers::class, 'preparationclassoffers_id');
|
||||||
|
}
|
||||||
|
}
|
36
app/Models/Log/ActivityLog.php
Normal file
36
app/Models/Log/ActivityLog.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Log;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ActivityLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $primaryKey = 'activity_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'controllerName',
|
||||||
|
'methodName',
|
||||||
|
'actionUrl',
|
||||||
|
'activity',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $appends = ['user_name'];
|
||||||
|
|
||||||
|
public function getUserNameAttribute()
|
||||||
|
{
|
||||||
|
$user = User::find($this->user_id);
|
||||||
|
return $user ? $user->name : '';
|
||||||
|
}
|
||||||
|
}
|
31
app/Models/Log/ErrorLog.php
Normal file
31
app/Models/Log/ErrorLog.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Log;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class ErrorLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $primaryKey = 'id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'controller_name',
|
||||||
|
'method_name',
|
||||||
|
'errors',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $appends = [];
|
||||||
|
|
||||||
|
|
||||||
|
}
|
37
app/Models/Log/LoginLog.php
Normal file
37
app/Models/Log/LoginLog.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Log;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class LoginLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $primaryKey = 'login_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'ip',
|
||||||
|
'user_agent',
|
||||||
|
'type',
|
||||||
|
'login_at',
|
||||||
|
'logout_at',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected $appends = ['user_name'];
|
||||||
|
|
||||||
|
public function getUserNameAttribute()
|
||||||
|
{
|
||||||
|
$user = User::find($this->user_id);
|
||||||
|
return $user ? $user->name : '';
|
||||||
|
}
|
||||||
|
}
|
40
app/Models/Log/OperationLog.php
Normal file
40
app/Models/Log/OperationLog.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Log;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class OperationLog extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
|
||||||
|
protected $primaryKey = 'operation_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'refNo',
|
||||||
|
'user_id',
|
||||||
|
'operation_start_no',
|
||||||
|
'operation_end_no',
|
||||||
|
'model_name',
|
||||||
|
'model_id',
|
||||||
|
'operation_name',
|
||||||
|
'previous_values',
|
||||||
|
'new_values',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
// protected $appends = ['operation_by'];
|
||||||
|
|
||||||
|
// public function getOperationByAttribute()
|
||||||
|
// {
|
||||||
|
// $user = User::find($this->user_id);
|
||||||
|
// return $user ? $user->name : '';
|
||||||
|
// }
|
||||||
|
}
|
71
app/Models/Menuitems.php
Normal file
71
app/Models/Menuitems.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
|
||||||
|
class Menuitems extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
protected $primaryKey = 'menu_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'parent_menu',
|
||||||
|
'menulocations_id',
|
||||||
|
'title',
|
||||||
|
'alias',
|
||||||
|
'type',
|
||||||
|
'ref',
|
||||||
|
'target',
|
||||||
|
'display_order',
|
||||||
|
'status',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createdBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updatedBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
public function parent()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Menuitems::class, 'parent_menu')->where('status', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function children()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Menuitems::class, 'parent_menu')->orderBy('display_order')->where('status', 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subchildren()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Menuitems::class, 'parent_menu')
|
||||||
|
->where('status', 1)
|
||||||
|
->orderBy('display_order')
|
||||||
|
->with('children');
|
||||||
|
}
|
||||||
|
}
|
48
app/Models/Menulocations.php
Normal file
48
app/Models/Menulocations.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
|
||||||
|
class Menulocations extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
protected $primaryKey = 'menulocation_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable =[
|
||||||
|
'title',
|
||||||
|
'alias',
|
||||||
|
'display_order',
|
||||||
|
'status',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createdBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updatedBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
80
app/Models/Settings.php
Normal file
80
app/Models/Settings.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
|
||||||
|
class Settings extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
protected $primaryKey = 'setting_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'description',
|
||||||
|
'url1',
|
||||||
|
'url2',
|
||||||
|
'email',
|
||||||
|
'location',
|
||||||
|
'phone',
|
||||||
|
'secondary_phone',
|
||||||
|
'google_map',
|
||||||
|
'fb',
|
||||||
|
'insta',
|
||||||
|
'twitter',
|
||||||
|
'tiktok',
|
||||||
|
'youtube',
|
||||||
|
'working_days',
|
||||||
|
'working_hours',
|
||||||
|
'leave_days',
|
||||||
|
'primary_logo',
|
||||||
|
'secondary_logo',
|
||||||
|
'thumb',
|
||||||
|
'icon',
|
||||||
|
'og_image',
|
||||||
|
'no_image',
|
||||||
|
'copyright_text',
|
||||||
|
'content1',
|
||||||
|
'content2',
|
||||||
|
'content3',
|
||||||
|
'seo_title',
|
||||||
|
'seo_description',
|
||||||
|
'seo_keywords',
|
||||||
|
'og_tags',
|
||||||
|
'display_order',
|
||||||
|
'status',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
'recaptcha_secret_key',
|
||||||
|
'recaptcha_site_key'
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createdBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updatedBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
50
app/Models/Shortcodes.php
Normal file
50
app/Models/Shortcodes.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
|
||||||
|
class Shortcodes extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
protected $primaryKey = 'shortcode_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable =[
|
||||||
|
'title',
|
||||||
|
'alias',
|
||||||
|
'text',
|
||||||
|
'description',
|
||||||
|
'display_order',
|
||||||
|
'status',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createdBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updatedBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
53
app/Models/Sitemenus.php
Normal file
53
app/Models/Sitemenus.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use App\Traits\CreatedUpdatedBy;
|
||||||
|
|
||||||
|
class Sitemenus extends Model
|
||||||
|
{
|
||||||
|
use HasFactory, CreatedUpdatedBy;
|
||||||
|
|
||||||
|
protected $primaryKey = 'menu_id';
|
||||||
|
public $timestamps = true;
|
||||||
|
protected $fillable =[
|
||||||
|
'parent_menu',
|
||||||
|
'menulocations_id',
|
||||||
|
'title',
|
||||||
|
'alias',
|
||||||
|
'type',
|
||||||
|
'ref',
|
||||||
|
'target',
|
||||||
|
'display_order',
|
||||||
|
'status',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'createdby',
|
||||||
|
'updatedby',
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
protected $appends = ['status_name'];
|
||||||
|
|
||||||
|
protected function getStatusNameAttribute()
|
||||||
|
{
|
||||||
|
return $this->status == 1 ? '<span class="badge text-bg-success-soft"> Active </span>' : '<span class="badge text-bg-danger-soft">Inactive</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function createdBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function updatedBy(): Attribute
|
||||||
|
{
|
||||||
|
return Attribute::make(
|
||||||
|
get: fn ($value) => User::find($value) ? User::find($value)->name : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
46
app/Models/User.php
Normal file
46
app/Models/User.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use Illuminate\Notifications\Notifiable;
|
||||||
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
|
|
||||||
|
class User extends Authenticatable
|
||||||
|
{
|
||||||
|
use HasApiTokens, HasFactory, Notifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'name',
|
||||||
|
'email',
|
||||||
|
'username',
|
||||||
|
'password',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be hidden for serialization.
|
||||||
|
*
|
||||||
|
* @var array<int, string>
|
||||||
|
*/
|
||||||
|
protected $hidden = [
|
||||||
|
'password',
|
||||||
|
'remember_token',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast.
|
||||||
|
*
|
||||||
|
* @var array<string, string>
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'email_verified_at' => 'datetime',
|
||||||
|
'password' => 'hashed',
|
||||||
|
];
|
||||||
|
}
|
50
app/Providers/AppServiceProvider.php
Normal file
50
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Blade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use App\Providers\ShortcodeProcessor;
|
||||||
|
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Register any application services.
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$this->app->singleton(ShortcodeProcessor::class, function ($app) {
|
||||||
|
return new ShortcodeProcessor();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
Blade::directive('shortcode', function ($expression) {
|
||||||
|
list($shortcodeName, $shortcodeAttributes) = explode(',', $expression, 2);
|
||||||
|
return "<?php echo view('shortcodes.$shortcodeName', $shortcodeAttributes)->render(); ?>";
|
||||||
|
});
|
||||||
|
|
||||||
|
Blade::directive('processshortcodes', function ($expression) {
|
||||||
|
return "<?php echo app('App\Providers\ShortcodeProcessor')->process($expression); ?>";
|
||||||
|
});
|
||||||
|
|
||||||
|
Blade::directive('customshortcode', function ($expression) {
|
||||||
|
return "<?php echo app('App\Providers\ShortcodeProcessor')->processShortcodes($expression); ?>";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processShortcodes($content)
|
||||||
|
{
|
||||||
|
return preg_replace_callback('/\[([\w_]+)([^\]]*)\]/', function ($matches) {
|
||||||
|
$shortcodeName = $matches[1];
|
||||||
|
$shortcodeAttributes = str::of($matches[2])->trim()->replace("'", "\"")->__toString();
|
||||||
|
return "@shortcode('$shortcodeName', $shortcodeAttributes)";
|
||||||
|
}, $content);
|
||||||
|
}
|
||||||
|
}
|
26
app/Providers/AuthServiceProvider.php
Normal file
26
app/Providers/AuthServiceProvider.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
// use Illuminate\Support\Facades\Gate;
|
||||||
|
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||||
|
|
||||||
|
class AuthServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The model to policy mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, class-string>
|
||||||
|
*/
|
||||||
|
protected $policies = [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any authentication / authorization services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
19
app/Providers/BroadcastServiceProvider.php
Normal file
19
app/Providers/BroadcastServiceProvider.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Broadcast;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
class BroadcastServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap any application services.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
Broadcast::routes();
|
||||||
|
|
||||||
|
require base_path('routes/channels.php');
|
||||||
|
}
|
||||||
|
}
|
38
app/Providers/EventServiceProvider.php
Normal file
38
app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Events\Registered;
|
||||||
|
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Event;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event to listener mappings for the application.
|
||||||
|
*
|
||||||
|
* @var array<class-string, array<int, class-string>>
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
Registered::class => [
|
||||||
|
SendEmailVerificationNotification::class,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine if events and listeners should be automatically discovered.
|
||||||
|
*/
|
||||||
|
public function shouldDiscoverEvents(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
40
app/Providers/RouteServiceProvider.php
Normal file
40
app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
|
class RouteServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The path to your application's "home" route.
|
||||||
|
*
|
||||||
|
* Typically, users are redirected here after authentication.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public const HOME = '/dashboard';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define your route model bindings, pattern filters, and other route configuration.
|
||||||
|
*/
|
||||||
|
public function boot(): void
|
||||||
|
{
|
||||||
|
RateLimiter::for('api', function (Request $request) {
|
||||||
|
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->routes(function () {
|
||||||
|
Route::middleware('api')
|
||||||
|
->prefix('api')
|
||||||
|
->group(base_path('routes/api.php'));
|
||||||
|
|
||||||
|
Route::middleware('web')
|
||||||
|
->group(base_path('routes/web.php'));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
21
app/Providers/ShortcodeProcessor.php
Normal file
21
app/Providers/ShortcodeProcessor.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class ShortcodeProcessor
|
||||||
|
{
|
||||||
|
public function process($content)
|
||||||
|
{
|
||||||
|
return preg_replace_callback('/\[([\w_]+)([^\]]*)\]/', function ($matches) {
|
||||||
|
$shortcodeName = $matches[1];
|
||||||
|
$shortcodeAttributes = Str::of($matches[2])->trim()->replace("'", "\"")->__toString();
|
||||||
|
return "@shortcode('$shortcodeName', $shortcodeAttributes)";
|
||||||
|
}, $content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processShortcodes($content)
|
||||||
|
{
|
||||||
|
return $this->process($content);
|
||||||
|
}
|
||||||
|
}
|
220
app/Service/CommonModelService.php
Normal file
220
app/Service/CommonModelService.php
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Service;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Yajra\DataTables\Facades\DataTables;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
|
class CommonModelService
|
||||||
|
{
|
||||||
|
protected $model;
|
||||||
|
|
||||||
|
public function __construct($model)
|
||||||
|
{
|
||||||
|
$this->model = $model;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create operation
|
||||||
|
* $operationStartNumber -> It is required first time if it contain multiple tables operation
|
||||||
|
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
|
||||||
|
* $oldValues -> On store/insert old values will be null
|
||||||
|
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
|
||||||
|
*/
|
||||||
|
public function create($operationStartNumber, $operationEndNumber, $oldValues, $newValues)
|
||||||
|
{
|
||||||
|
$baseClass = get_class($this->model);
|
||||||
|
$modelData = $this->model->create($newValues);
|
||||||
|
$prmimayKeyFieldName = $modelData->getKeyName();
|
||||||
|
$ModelID = $modelData->$prmimayKeyFieldName;
|
||||||
|
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'create', $oldValues, $modelData);
|
||||||
|
return $modelData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update operation
|
||||||
|
* $operationStartNumber -> It is required first time if it contain multiple tables operation
|
||||||
|
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
|
||||||
|
* $oldValues -> On store/insert old values case, is required only if it is updated on direct table on like users_roles table case other wise We get here
|
||||||
|
* null but find from model Id. It will be also stored in json format.
|
||||||
|
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
|
||||||
|
*/
|
||||||
|
public function update($operationStartNumber, $operationEndNumber, $oldValues, $newValues, $ModelID)
|
||||||
|
{
|
||||||
|
|
||||||
|
$baseClass = get_class($this->model);
|
||||||
|
$this->model = $this->model->find($ModelID);
|
||||||
|
$oldValues = !empty($oldValues) ? $oldValues : $this->model->toArray();
|
||||||
|
$this->model->update($newValues);
|
||||||
|
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'update', $oldValues, $this->model->getChanges());
|
||||||
|
return $this->model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create operation
|
||||||
|
* $operationStartNumber -> It is required first time if it contain multiple tables operation
|
||||||
|
* $operationEndNumber -> It is required Every time on any operation because on showing block it is required.
|
||||||
|
* $oldValues -> On store/insert old values will be null
|
||||||
|
* $newValues => On store/insert operation $new values will be model created object values and stoe in json format.
|
||||||
|
*/
|
||||||
|
public function destroy($operationStartNumber, $operationEndNumber, $ModelID)
|
||||||
|
{
|
||||||
|
|
||||||
|
$baseClass = get_class($this->model);
|
||||||
|
$this->model = $this->model->find($ModelID);
|
||||||
|
$oldValues = ['status' => $this->model->status];
|
||||||
|
$this->model->update(['status' => '-1']);
|
||||||
|
createOperationLog($operationStartNumber, $operationEndNumber, $baseClass, $ModelID, 'delete', $oldValues, ['status' => '-1']);
|
||||||
|
|
||||||
|
return $this->model;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Paginate all User
|
||||||
|
*
|
||||||
|
* @param array $filter
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function paginate(array $filter = [])
|
||||||
|
{
|
||||||
|
$filter['limit'] = 25;
|
||||||
|
|
||||||
|
return $this->model->orderBy('id', 'DESC')->whereIsDeleted('no')->paginate($filter['limit']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all User
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
public function all()
|
||||||
|
{
|
||||||
|
return $this->model->whereIsDeleted('no')->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all users with supervisor type
|
||||||
|
*
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public function find($userId)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return $this->model->whereIsDeleted('no')->find($userId);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public function update($userId, array $data)
|
||||||
|
// {
|
||||||
|
// try {
|
||||||
|
|
||||||
|
// $data['visibility'] = (isset($data['visibility']) ? $data['visibility'] : '') == 'on' ? 'visible' : 'invisible';
|
||||||
|
// $data['status'] = (isset($data['status']) ? $data['status'] : '') == 'on' ? 'active' : 'in_active';
|
||||||
|
// $data['availability'] = (isset($data['availability']) ? $data['availability'] : '') == 'on' ? 'available' : 'not_available';
|
||||||
|
// $data['has_subuser'] = (isset($data['has_subuser']) ? $data['has_subuser'] : '') == 'on' ? 'yes' : 'no';
|
||||||
|
// $data['last_updated_by'] = Auth::user()->id;
|
||||||
|
// $user = $this->model->find($userId);
|
||||||
|
|
||||||
|
// $user = $user->update($data);
|
||||||
|
// $this->logger->info(' created successfully', $data);
|
||||||
|
|
||||||
|
// return $user;
|
||||||
|
// } catch (Exception $e) {
|
||||||
|
// $this->logger->error($e->getMessage());
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a User
|
||||||
|
*
|
||||||
|
* @param Id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function delete($userId)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$data['last_deleted_by'] = Auth::user()->id;
|
||||||
|
$data['deleted_at'] = Carbon::now();
|
||||||
|
$user = $this->model->find($userId);
|
||||||
|
$data['is_deleted'] = 'yes';
|
||||||
|
return $user = $user->update($data);
|
||||||
|
// dd($user);
|
||||||
|
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getUserRoles($id)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$user = User::with('roles')->find($id);
|
||||||
|
$roles = $user->roles;
|
||||||
|
return $roles;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* write brief description
|
||||||
|
* @param $name
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getByName($name)
|
||||||
|
{
|
||||||
|
return $this->model->whereIsDeleted('no')->whereName($name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBySlug($id)
|
||||||
|
{
|
||||||
|
return $this->model->whereIsDeleted('no')->whereId($id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function uploadFile($file)
|
||||||
|
{
|
||||||
|
if (!empty($file)) {
|
||||||
|
$this->uploadPath = 'uploads/user';
|
||||||
|
return $fileName = $this->uploadFromAjax($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __deleteImages($subCat)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (is_file($subCat->image_path))
|
||||||
|
unlink($subCat->image_path);
|
||||||
|
|
||||||
|
if (is_file($subCat->thumbnail_path))
|
||||||
|
unlink($subCat->thumbnail_path);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function updateImage($userId, array $data)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$user = $this->model->find($userId);
|
||||||
|
$user = $user->update($data);
|
||||||
|
|
||||||
|
return $user;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
//$this->logger->error($e->getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
32
app/Traits/CreatedUpdatedBy.php
Normal file
32
app/Traits/CreatedUpdatedBy.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Traits;
|
||||||
|
|
||||||
|
trait CreatedUpdatedBy
|
||||||
|
{
|
||||||
|
public static function bootCreatedUpdatedBy()
|
||||||
|
{
|
||||||
|
// updating created_by and updated_by when model is created
|
||||||
|
static::creating(function ($model) {
|
||||||
|
if (!$model->isDirty('createdBy')) {
|
||||||
|
$model->createdBy = auth()->user() ? auth()->user()->id : null;
|
||||||
|
}
|
||||||
|
if (!$model->isDirty('updatedBy')) {
|
||||||
|
$model->updatedBy = auth()->user() ? auth()->user()->id : null;
|
||||||
|
}
|
||||||
|
if ($model->isDirty('createdOn') && !$model->isDirty('createdOn')) {
|
||||||
|
$model->createdOn = now();
|
||||||
|
}
|
||||||
|
if (!$model->isDirty('status')) {
|
||||||
|
$model->status = 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// updating updated_by when model is updated
|
||||||
|
static::updating(function ($model) {
|
||||||
|
if (!$model->isDirty('updatedBy')) {
|
||||||
|
$model->updatedBy = auth()->user() ? auth()->user()->id : 1;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
17
app/View/Components/AppLayout.php
Normal file
17
app/View/Components/AppLayout.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class AppLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.app');
|
||||||
|
}
|
||||||
|
}
|
17
app/View/Components/GuestLayout.php
Normal file
17
app/View/Components/GuestLayout.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components;
|
||||||
|
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class GuestLayout extends Component
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Get the view / contents that represents the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('layouts.guest');
|
||||||
|
}
|
||||||
|
}
|
53
artisan
Normal file
53
artisan
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
|
||||||
|
define('LARAVEL_START', microtime(true));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register The Auto Loader
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Composer provides a convenient, automatically generated class loader
|
||||||
|
| for our application. We just need to utilize it! We'll require it
|
||||||
|
| into the script here so that we do not have to worry about the
|
||||||
|
| loading of any of our classes manually. It's great to relax.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
require __DIR__.'/vendor/autoload.php';
|
||||||
|
|
||||||
|
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Run The Artisan Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When we run the console application, the current CLI command will be
|
||||||
|
| executed in this console and the response sent back to a terminal
|
||||||
|
| or another output device for the developers. Here goes nothing!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||||
|
|
||||||
|
$status = $kernel->handle(
|
||||||
|
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||||
|
new Symfony\Component\Console\Output\ConsoleOutput
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Shutdown The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Once Artisan has finished running, we will fire off the shutdown events
|
||||||
|
| so that any final work may be done by the application before we shut
|
||||||
|
| down the process. This is the last thing to happen to the request.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$kernel->terminate($input, $status);
|
||||||
|
|
||||||
|
exit($status);
|
55
bootstrap/app.php
Executable file
55
bootstrap/app.php
Executable file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Create The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The first thing we will do is create a new Laravel application instance
|
||||||
|
| which serves as the "glue" for all the components of Laravel, and is
|
||||||
|
| the IoC container for the system binding all of the various parts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$app = new Illuminate\Foundation\Application(
|
||||||
|
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bind Important Interfaces
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, we need to bind some important interfaces into the container so
|
||||||
|
| we will be able to resolve them when needed. The kernels serve the
|
||||||
|
| incoming requests to this application from both the web and CLI.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
$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 The Application
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This script returns the application instance. The instance is given to
|
||||||
|
| the calling script so we can separate the building of the instances
|
||||||
|
| from the actual running of the application and sending responses.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
return $app;
|
2
bootstrap/cache/.gitignore
vendored
Executable file
2
bootstrap/cache/.gitignore
vendored
Executable file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
77
composer.json
Normal file
77
composer.json
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"name": "laravel/laravel",
|
||||||
|
"type": "project",
|
||||||
|
"description": "The skeleton application for the Laravel framework.",
|
||||||
|
"keywords": ["laravel", "framework"],
|
||||||
|
"license": "MIT",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1.17",
|
||||||
|
"froiden/laravel-installer": "^1.9",
|
||||||
|
"google/recaptcha": "^1.3",
|
||||||
|
"guzzlehttp/guzzle": "^7.2",
|
||||||
|
"laravel/framework": "^10.10",
|
||||||
|
"laravel/sanctum": "^3.2",
|
||||||
|
"laravel/tinker": "^2.8",
|
||||||
|
"symfony/process": "^6.3",
|
||||||
|
"unisharp/laravel-filemanager": "^2.6"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"barryvdh/laravel-debugbar": "^3.9",
|
||||||
|
"fakerphp/faker": "^1.9.1",
|
||||||
|
"laravel/breeze": "^1.21",
|
||||||
|
"laravel/pint": "^1.0",
|
||||||
|
"laravel/sail": "^1.18",
|
||||||
|
"mockery/mockery": "^1.4.4",
|
||||||
|
"nunomaduro/collision": "^7.0",
|
||||||
|
"phpunit/phpunit": "^10.1",
|
||||||
|
"spatie/laravel-ignition": "^2.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"App\\": "app/",
|
||||||
|
"Database\\Factories\\": "database/factories/",
|
||||||
|
"Database\\Seeders\\": "database/seeders/"
|
||||||
|
},
|
||||||
|
"files":[
|
||||||
|
"app/Helpers/CCMS.php",
|
||||||
|
"app/Helpers/BibClass.php",
|
||||||
|
"app/Helpers/bibHelper.php"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"autoload-dev": {
|
||||||
|
"psr-4": {
|
||||||
|
"Tests\\": "tests/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||||
|
"@php artisan package:discover --ansi"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||||
|
],
|
||||||
|
"post-root-package-install": [
|
||||||
|
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||||
|
],
|
||||||
|
"post-create-project-cmd": [
|
||||||
|
"@php artisan key:generate --ansi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"dont-discover": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"optimize-autoloader": true,
|
||||||
|
"preferred-install": "dist",
|
||||||
|
"sort-packages": true,
|
||||||
|
"allow-plugins": {
|
||||||
|
"pestphp/pest-plugin": true,
|
||||||
|
"php-http/discovery": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"minimum-stability": "stable",
|
||||||
|
"prefer-stable": true
|
||||||
|
}
|
8645
composer.lock
generated
Normal file
8645
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
191
config/app.php
Normal file
191
config/app.php
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Facade;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value is the name of your application. This value is used when the
|
||||||
|
| framework needs to place the application's name in a notification or
|
||||||
|
| any other location as required by the application or its packages.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'name' => env('APP_NAME', 'Laravel'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Environment
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value determines the "environment" your application is currently
|
||||||
|
| running in. This may determine how you prefer to configure various
|
||||||
|
| services the application utilizes. Set this in your ".env" file.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'env' => env('APP_ENV', 'production'),
|
||||||
|
|
||||||
|
'client_path' => env('CLIENT_PATH', 'accessskills'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Debug Mode
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When your application is in debug mode, detailed error messages with
|
||||||
|
| stack traces will be shown on every error that occurs within your
|
||||||
|
| application. If disabled, a simple generic error page is shown.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'debug' => (bool) env('APP_DEBUG', false),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application URL
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This URL is used by the console to properly generate URLs when using
|
||||||
|
| the Artisan command line tool. You should set this to the root of
|
||||||
|
| your application so that it is used when running Artisan tasks.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'url' => env('APP_URL', 'http://localhost'),
|
||||||
|
|
||||||
|
'asset_url' => env('ASSET_URL'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Timezone
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default timezone for your application, which
|
||||||
|
| will be used by the PHP date and date-time functions. We have gone
|
||||||
|
| ahead and set this to a sensible default for you out of the box.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'timezone' => 'UTC',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Locale Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The application locale determines the default locale that will be used
|
||||||
|
| by the translation service provider. You are free to set this value
|
||||||
|
| to any of the locales which will be supported by the application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'locale' => 'en',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Application Fallback Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The fallback locale determines the locale to use when the current one
|
||||||
|
| is not available. You may change the value to correspond to any of
|
||||||
|
| the language folders that are provided through your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'fallback_locale' => 'en',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Faker Locale
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This locale will be used by the Faker PHP library when generating fake
|
||||||
|
| data for your database seeds. For example, this will be used to get
|
||||||
|
| localized telephone numbers, street address information and more.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'faker_locale' => 'en_US',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Encryption Key
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This key is used by the Illuminate encrypter service and should be set
|
||||||
|
| to a random, 32 character string, otherwise these encrypted strings
|
||||||
|
| will not be safe. Please do this before deploying an application!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'key' => env('APP_KEY'),
|
||||||
|
|
||||||
|
'cipher' => 'AES-256-CBC',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Maintenance Mode Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These configuration options determine the driver used to determine and
|
||||||
|
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||||
|
| allow maintenance mode to be controlled across multiple machines.
|
||||||
|
|
|
||||||
|
| Supported drivers: "file", "cache"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'maintenance' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
// 'store' => 'redis',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Autoloaded Service Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The service providers listed here will be automatically loaded on the
|
||||||
|
| request to your application. Feel free to add your own services to
|
||||||
|
| this array to grant expanded functionality to your applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => ServiceProvider::defaultProviders()->merge([
|
||||||
|
/*
|
||||||
|
* Package Service Providers...
|
||||||
|
*/
|
||||||
|
Froiden\LaravelInstaller\Providers\LaravelInstallerServiceProvider::class,
|
||||||
|
/*
|
||||||
|
* Application Service Providers...
|
||||||
|
*/
|
||||||
|
App\Providers\AppServiceProvider::class,
|
||||||
|
App\Providers\AuthServiceProvider::class,
|
||||||
|
// App\Providers\BroadcastServiceProvider::class,
|
||||||
|
App\Providers\EventServiceProvider::class,
|
||||||
|
App\Providers\RouteServiceProvider::class,
|
||||||
|
|
||||||
|
])->toArray(),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Class Aliases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array of class aliases will be registered when this application
|
||||||
|
| is started. However, feel free to register as many as you wish as
|
||||||
|
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'aliases' => Facade::defaultAliases()->merge([
|
||||||
|
// 'Example' => App\Facades\Example::class,
|
||||||
|
])->toArray(),
|
||||||
|
|
||||||
|
];
|
115
config/auth.php
Normal file
115
config/auth.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Defaults
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default authentication "guard" and password
|
||||||
|
| reset options for your application. You may change these defaults
|
||||||
|
| as required, but they're a perfect start for most applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'defaults' => [
|
||||||
|
'guard' => 'web',
|
||||||
|
'passwords' => 'users',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Authentication Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Next, you may define every authentication guard for your application.
|
||||||
|
| Of course, a great default configuration has been defined for you
|
||||||
|
| here which uses session storage and the Eloquent user provider.
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| Supported: "session"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guards' => [
|
||||||
|
'web' => [
|
||||||
|
'driver' => 'session',
|
||||||
|
'provider' => 'users',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| User Providers
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| All authentication drivers have a user provider. This defines how the
|
||||||
|
| users are actually retrieved out of your database or other storage
|
||||||
|
| mechanisms used by this application to persist your user's data.
|
||||||
|
|
|
||||||
|
| If you have multiple user tables or models you may configure multiple
|
||||||
|
| sources which represent each model / table. These sources may then
|
||||||
|
| be assigned to any extra authentication guards you have defined.
|
||||||
|
|
|
||||||
|
| Supported: "database", "eloquent"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'providers' => [
|
||||||
|
'users' => [
|
||||||
|
'driver' => 'eloquent',
|
||||||
|
'model' => App\Models\User::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
// 'users' => [
|
||||||
|
// 'driver' => 'database',
|
||||||
|
// 'table' => 'users',
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Resetting Passwords
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may specify multiple password reset configurations if you have more
|
||||||
|
| than one user table or model in the application and you want to have
|
||||||
|
| separate password reset settings based on the specific user types.
|
||||||
|
|
|
||||||
|
| The expiry time is the number of minutes that each reset token will be
|
||||||
|
| considered valid. This security feature keeps tokens short-lived so
|
||||||
|
| they have less time to be guessed. You may change this as needed.
|
||||||
|
|
|
||||||
|
| The throttle setting is the number of seconds a user must wait before
|
||||||
|
| generating more password reset tokens. This prevents the user from
|
||||||
|
| quickly generating a very large amount of password reset tokens.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'passwords' => [
|
||||||
|
'users' => [
|
||||||
|
'provider' => 'users',
|
||||||
|
'table' => 'password_reset_tokens',
|
||||||
|
'expire' => 60,
|
||||||
|
'throttle' => 60,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Confirmation Timeout
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define the amount of seconds before a password confirmation
|
||||||
|
| times out and the user is prompted to re-enter their password via the
|
||||||
|
| confirmation screen. By default, the timeout lasts for three hours.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'password_timeout' => 10800,
|
||||||
|
|
||||||
|
];
|
302
config/backup.php
Normal file
302
config/backup.php
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
'backup' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The name of this application. You can use this name to monitor
|
||||||
|
* the backups.
|
||||||
|
*/
|
||||||
|
'name' => env('APP_NAME', 'laravel-backup'),
|
||||||
|
|
||||||
|
'source' => [
|
||||||
|
|
||||||
|
'files' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The list of directories and files that will be included in the backup.
|
||||||
|
*/
|
||||||
|
'include' => [
|
||||||
|
base_path(),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These directories and files will be excluded from the backup.
|
||||||
|
*
|
||||||
|
* Directories used by the backup process will automatically be excluded.
|
||||||
|
*/
|
||||||
|
'exclude' => [
|
||||||
|
base_path('vendor'),
|
||||||
|
base_path('node_modules'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determines if symlinks should be followed.
|
||||||
|
*/
|
||||||
|
'follow_links' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Determines if it should avoid unreadable folders.
|
||||||
|
*/
|
||||||
|
'ignore_unreadable_directories' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This path is used to make directories in resulting zip-file relative
|
||||||
|
* Set to `null` to include complete absolute path
|
||||||
|
* Example: base_path()
|
||||||
|
*/
|
||||||
|
'relative_path' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The names of the connections to the databases that should be backed up
|
||||||
|
* MySQL, PostgreSQL, SQLite and Mongo databases are supported.
|
||||||
|
*
|
||||||
|
* The content of the database dump may be customized for each connection
|
||||||
|
* by adding a 'dump' key to the connection settings in config/database.php.
|
||||||
|
* E.g.
|
||||||
|
* 'mysql' => [
|
||||||
|
* ...
|
||||||
|
* 'dump' => [
|
||||||
|
* 'excludeTables' => [
|
||||||
|
* 'table_to_exclude_from_backup',
|
||||||
|
* 'another_table_to_exclude'
|
||||||
|
* ]
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
*
|
||||||
|
* If you are using only InnoDB tables on a MySQL server, you can
|
||||||
|
* also supply the useSingleTransaction option to avoid table locking.
|
||||||
|
*
|
||||||
|
* E.g.
|
||||||
|
* 'mysql' => [
|
||||||
|
* ...
|
||||||
|
* 'dump' => [
|
||||||
|
* 'useSingleTransaction' => true,
|
||||||
|
* ],
|
||||||
|
* ],
|
||||||
|
*
|
||||||
|
* For a complete list of available customization options, see https://github.com/spatie/db-dumper
|
||||||
|
*/
|
||||||
|
'databases' => [
|
||||||
|
'mysql',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The database dump can be compressed to decrease disk space usage.
|
||||||
|
*
|
||||||
|
* Out of the box Laravel-backup supplies
|
||||||
|
* Spatie\DbDumper\Compressors\GzipCompressor::class.
|
||||||
|
*
|
||||||
|
* You can also create custom compressor. More info on that here:
|
||||||
|
* https://github.com/spatie/db-dumper#using-compression
|
||||||
|
*
|
||||||
|
* If you do not want any compressor at all, set it to null.
|
||||||
|
*/
|
||||||
|
'database_dump_compressor' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The file extension used for the database dump files.
|
||||||
|
*
|
||||||
|
* If not specified, the file extension will be .archive for MongoDB and .sql for all other databases
|
||||||
|
* The file extension should be specified without a leading .
|
||||||
|
*/
|
||||||
|
'database_dump_file_extension' => '',
|
||||||
|
|
||||||
|
'destination' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The filename prefix used for the backup zip file.
|
||||||
|
*/
|
||||||
|
'filename_prefix' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The disk names on which the backups will be stored.
|
||||||
|
*/
|
||||||
|
'disks' => [
|
||||||
|
'local',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The directory where the temporary files will be stored.
|
||||||
|
*/
|
||||||
|
'temporary_directory' => storage_path('app/backup-temp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The password to be used for archive encryption.
|
||||||
|
* Set to `null` to disable encryption.
|
||||||
|
*/
|
||||||
|
'password' => env('BACKUP_ARCHIVE_PASSWORD'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The encryption algorithm to be used for archive encryption.
|
||||||
|
* You can set it to `null` or `false` to disable encryption.
|
||||||
|
*
|
||||||
|
* When set to 'default', we'll use ZipArchive::EM_AES_256 if it is
|
||||||
|
* available on your system.
|
||||||
|
*/
|
||||||
|
'encryption' => 'default',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of attempts, in case the backup command encounters an exception
|
||||||
|
*/
|
||||||
|
'tries' => 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of seconds to wait before attempting a new backup if the previous try failed
|
||||||
|
* Set to `0` for none
|
||||||
|
*/
|
||||||
|
'retry_delay' => 0,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* You can get notified when specific events occur. Out of the box you can use 'mail' and 'slack'.
|
||||||
|
* For Slack you need to install laravel/slack-notification-channel.
|
||||||
|
*
|
||||||
|
* You can also use your own notification classes, just make sure the class is named after one of
|
||||||
|
* the `Spatie\Backup\Notifications\Notifications` classes.
|
||||||
|
*/
|
||||||
|
'notifications' => [
|
||||||
|
|
||||||
|
'notifications' => [
|
||||||
|
\Spatie\Backup\Notifications\Notifications\BackupHasFailedNotification::class => ['mail'],
|
||||||
|
\Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFoundNotification::class => ['mail'],
|
||||||
|
\Spatie\Backup\Notifications\Notifications\CleanupHasFailedNotification::class => ['mail'],
|
||||||
|
\Spatie\Backup\Notifications\Notifications\BackupWasSuccessfulNotification::class => ['mail'],
|
||||||
|
\Spatie\Backup\Notifications\Notifications\HealthyBackupWasFoundNotification::class => ['mail'],
|
||||||
|
\Spatie\Backup\Notifications\Notifications\CleanupWasSuccessfulNotification::class => ['mail'],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Here you can specify the notifiable to which the notifications should be sent. The default
|
||||||
|
* notifiable will use the variables specified in this config file.
|
||||||
|
*/
|
||||||
|
'notifiable' => \Spatie\Backup\Notifications\Notifiable::class,
|
||||||
|
|
||||||
|
'mail' => [
|
||||||
|
'to' => 'your@example.com',
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'webhook_url' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this is set to null the default channel of the webhook will be used.
|
||||||
|
*/
|
||||||
|
'channel' => null,
|
||||||
|
|
||||||
|
'username' => null,
|
||||||
|
|
||||||
|
'icon' => null,
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
'discord' => [
|
||||||
|
'webhook_url' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this is an empty string, the name field on the webhook will be used.
|
||||||
|
*/
|
||||||
|
'username' => '',
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If this is an empty string, the avatar on the webhook will be used.
|
||||||
|
*/
|
||||||
|
'avatar_url' => '',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Here you can specify which backups should be monitored.
|
||||||
|
* If a backup does not meet the specified requirements the
|
||||||
|
* UnHealthyBackupWasFound event will be fired.
|
||||||
|
*/
|
||||||
|
'monitor_backups' => [
|
||||||
|
[
|
||||||
|
'name' => env('APP_NAME', 'laravel-backup'),
|
||||||
|
'disks' => ['local'],
|
||||||
|
'health_checks' => [
|
||||||
|
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||||
|
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
[
|
||||||
|
'name' => 'name of the second app',
|
||||||
|
'disks' => ['local', 's3'],
|
||||||
|
'health_checks' => [
|
||||||
|
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumAgeInDays::class => 1,
|
||||||
|
\Spatie\Backup\Tasks\Monitor\HealthChecks\MaximumStorageInMegabytes::class => 5000,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
*/
|
||||||
|
],
|
||||||
|
|
||||||
|
'cleanup' => [
|
||||||
|
/*
|
||||||
|
* The strategy that will be used to cleanup old backups. The default strategy
|
||||||
|
* will keep all backups for a certain amount of days. After that period only
|
||||||
|
* a daily backup will be kept. After that period only weekly backups will
|
||||||
|
* be kept and so on.
|
||||||
|
*
|
||||||
|
* No matter how you configure it the default strategy will never
|
||||||
|
* delete the newest backup.
|
||||||
|
*/
|
||||||
|
'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class,
|
||||||
|
|
||||||
|
'default_strategy' => [
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of days for which backups must be kept.
|
||||||
|
*/
|
||||||
|
'keep_all_backups_for_days' => 7,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of days for which daily backups must be kept.
|
||||||
|
*/
|
||||||
|
'keep_daily_backups_for_days' => 16,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of weeks for which one weekly backup must be kept.
|
||||||
|
*/
|
||||||
|
'keep_weekly_backups_for_weeks' => 8,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of months for which one monthly backup must be kept.
|
||||||
|
*/
|
||||||
|
'keep_monthly_backups_for_months' => 4,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The number of years for which one yearly backup must be kept.
|
||||||
|
*/
|
||||||
|
'keep_yearly_backups_for_years' => 2,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* After cleaning up the backups remove the oldest backup until
|
||||||
|
* this amount of megabytes has been reached.
|
||||||
|
*/
|
||||||
|
'delete_oldest_backups_when_using_more_megabytes_than' => 5000,
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of attempts, in case the cleanup command encounters an exception
|
||||||
|
*/
|
||||||
|
'tries' => 1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The number of seconds to wait before attempting a new cleanup if the previous try failed
|
||||||
|
* Set to `0` for none
|
||||||
|
*/
|
||||||
|
'retry_delay' => 0,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
71
config/broadcasting.php
Normal file
71
config/broadcasting.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Broadcaster
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default broadcaster that will be used by the
|
||||||
|
| framework when an event needs to be broadcast. You may set this to
|
||||||
|
| any of the connections defined in the "connections" array below.
|
||||||
|
|
|
||||||
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Broadcast Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the broadcast connections that will be used
|
||||||
|
| to broadcast events to other systems or over websockets. Samples of
|
||||||
|
| each available type of connection are provided inside this array.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'pusher' => [
|
||||||
|
'driver' => 'pusher',
|
||||||
|
'key' => env('PUSHER_APP_KEY'),
|
||||||
|
'secret' => env('PUSHER_APP_SECRET'),
|
||||||
|
'app_id' => env('PUSHER_APP_ID'),
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('PUSHER_APP_CLUSTER'),
|
||||||
|
'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||||
|
'port' => env('PUSHER_PORT', 443),
|
||||||
|
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||||
|
'encrypted' => true,
|
||||||
|
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||||
|
],
|
||||||
|
'client_options' => [
|
||||||
|
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'ably' => [
|
||||||
|
'driver' => 'ably',
|
||||||
|
'key' => env('ABLY_KEY'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'driver' => 'log',
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'null',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
111
config/cache.php
Normal file
111
config/cache.php
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default cache connection that gets used while
|
||||||
|
| using this caching library. This connection is used when another is
|
||||||
|
| not explicitly specified when executing a given caching function.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('CACHE_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Stores
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may define all of the cache "stores" for your application as
|
||||||
|
| well as their drivers. You may even define multiple stores for the
|
||||||
|
| same cache driver to group types of items stored in your caches.
|
||||||
|
|
|
||||||
|
| Supported drivers: "apc", "array", "database", "file",
|
||||||
|
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stores' => [
|
||||||
|
|
||||||
|
'apc' => [
|
||||||
|
'driver' => 'apc',
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'driver' => 'array',
|
||||||
|
'serialize' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'cache',
|
||||||
|
'connection' => null,
|
||||||
|
'lock_connection' => null,
|
||||||
|
],
|
||||||
|
|
||||||
|
'file' => [
|
||||||
|
'driver' => 'file',
|
||||||
|
'path' => storage_path('framework/cache/data'),
|
||||||
|
'lock_path' => storage_path('framework/cache/data'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'memcached' => [
|
||||||
|
'driver' => 'memcached',
|
||||||
|
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||||
|
'sasl' => [
|
||||||
|
env('MEMCACHED_USERNAME'),
|
||||||
|
env('MEMCACHED_PASSWORD'),
|
||||||
|
],
|
||||||
|
'options' => [
|
||||||
|
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||||
|
],
|
||||||
|
'servers' => [
|
||||||
|
[
|
||||||
|
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('MEMCACHED_PORT', 11211),
|
||||||
|
'weight' => 100,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'cache',
|
||||||
|
'lock_connection' => 'default',
|
||||||
|
],
|
||||||
|
|
||||||
|
'dynamodb' => [
|
||||||
|
'driver' => 'dynamodb',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||||
|
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'octane' => [
|
||||||
|
'driver' => 'octane',
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cache Key Prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||||
|
| stores there might be other applications using the same cache. For
|
||||||
|
| that reason, you may prefix every cache key to avoid collisions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||||
|
|
||||||
|
];
|
34
config/cors.php
Normal file
34
config/cors.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure your settings for cross-origin resource sharing
|
||||||
|
| or "CORS". This determines what cross-origin operations may execute
|
||||||
|
| in web browsers. You are free to adjust these settings as needed.
|
||||||
|
|
|
||||||
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||||
|
|
||||||
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins' => ['*'],
|
||||||
|
|
||||||
|
'allowed_origins_patterns' => [],
|
||||||
|
|
||||||
|
'allowed_headers' => ['*'],
|
||||||
|
|
||||||
|
'exposed_headers' => [],
|
||||||
|
|
||||||
|
'max_age' => 0,
|
||||||
|
|
||||||
|
'supports_credentials' => false,
|
||||||
|
|
||||||
|
];
|
151
config/database.php
Normal file
151
config/database.php
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Database Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify which of the database connections below you wish
|
||||||
|
| to use as your default connection for all database work. Of course
|
||||||
|
| you may use many connections at once using the Database library.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Database Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here are each of the database connections setup for your application.
|
||||||
|
| Of course, examples of configuring each database platform that is
|
||||||
|
| supported by Laravel is shown below to make development simple.
|
||||||
|
|
|
||||||
|
|
|
||||||
|
| All database work in Laravel is done through the PHP PDO facilities
|
||||||
|
| so make sure you have the driver for your particular database of
|
||||||
|
| choice installed on your machine before you begin development.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sqlite' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||||
|
'prefix' => env('DB_TABLE_PREFIX', ''),
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
],
|
||||||
|
|
||||||
|
'mysql' => [
|
||||||
|
'driver' => 'mysql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '3306'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'unix_socket' => env('DB_SOCKET', ''),
|
||||||
|
'charset' => 'utf8mb4',
|
||||||
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
|
'prefix' => env('DB_TABLE_PREFIX', ''),
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'strict' => true,
|
||||||
|
'engine' => null,
|
||||||
|
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||||
|
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||||
|
]) : [],
|
||||||
|
],
|
||||||
|
|
||||||
|
'pgsql' => [
|
||||||
|
'driver' => 'pgsql',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', '127.0.0.1'),
|
||||||
|
'port' => env('DB_PORT', '5432'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'prefix' => env('DB_TABLE_PREFIX', ''),
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
'search_path' => 'public',
|
||||||
|
'sslmode' => 'prefer',
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqlsrv' => [
|
||||||
|
'driver' => 'sqlsrv',
|
||||||
|
'url' => env('DATABASE_URL'),
|
||||||
|
'host' => env('DB_HOST', 'localhost'),
|
||||||
|
'port' => env('DB_PORT', '1433'),
|
||||||
|
'database' => env('DB_DATABASE', 'forge'),
|
||||||
|
'username' => env('DB_USERNAME', 'forge'),
|
||||||
|
'password' => env('DB_PASSWORD', ''),
|
||||||
|
'charset' => 'utf8',
|
||||||
|
'prefix' => env('DB_TABLE_PREFIX', ''),
|
||||||
|
'prefix_indexes' => true,
|
||||||
|
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||||
|
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Migration Repository Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This table keeps track of all the migrations that have already run for
|
||||||
|
| your application. Using this information, we can determine which of
|
||||||
|
| the migrations on disk haven't actually been run in the database.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'migrations' => 'migrations',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Redis Databases
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Redis is an open source, fast, and advanced key-value store that also
|
||||||
|
| provides a richer body of commands than a typical key-value system
|
||||||
|
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
|
||||||
|
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||||
|
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'default' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_DB', '0'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cache' => [
|
||||||
|
'url' => env('REDIS_URL'),
|
||||||
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||||
|
'username' => env('REDIS_USERNAME'),
|
||||||
|
'password' => env('REDIS_PASSWORD'),
|
||||||
|
'port' => env('REDIS_PORT', '6379'),
|
||||||
|
'database' => env('REDIS_CACHE_DB', '1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
281
config/debugbar.php
Normal file
281
config/debugbar.php
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Debugbar Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Debugbar is enabled by default, when debug is set to true in app.php.
|
||||||
|
| You can override the value by setting enable to true or false instead of null.
|
||||||
|
|
|
||||||
|
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'enabled' => env('DEBUGBAR_ENABLED', null),
|
||||||
|
'except' => [
|
||||||
|
'telescope*',
|
||||||
|
'horizon*',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Storage settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| DebugBar stores data for session/ajax requests.
|
||||||
|
| You can disable this, so the debugbar stores data in headers/session,
|
||||||
|
| but this can cause problems with large data collectors.
|
||||||
|
| By default, file storage (in the storage folder) is used. Redis and PDO
|
||||||
|
| can also be used. For PDO, run the package migrations first.
|
||||||
|
|
|
||||||
|
| Warning: Enabling storage.open will allow everyone to access previous
|
||||||
|
| request, do not enable open storage in publicly available environments!
|
||||||
|
| Specify a callback if you want to limit based on IP or authentication.
|
||||||
|
*/
|
||||||
|
'storage' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'open' => env('DEBUGBAR_OPEN_STORAGE', false), // bool/callback.
|
||||||
|
'driver' => 'file', // redis, file, pdo, socket, custom
|
||||||
|
'path' => storage_path('debugbar'), // For file driver
|
||||||
|
'connection' => null, // Leave null for default connection (Redis/PDO)
|
||||||
|
'provider' => '', // Instance of StorageInterface for custom driver
|
||||||
|
'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver
|
||||||
|
'port' => 2304, // Port to use with the "socket" driver
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Editor
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Choose your preferred editor to use when clicking file name.
|
||||||
|
|
|
||||||
|
| Supported: "phpstorm", "vscode", "vscode-insiders", "vscode-remote",
|
||||||
|
| "vscode-insiders-remote", "vscodium", "textmate", "emacs",
|
||||||
|
| "sublime", "atom", "nova", "macvim", "idea", "netbeans",
|
||||||
|
| "xdebug", "espresso"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'editor' => env('DEBUGBAR_EDITOR', 'phpstorm'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Remote Path Mapping
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using a remote dev server, like Laravel Homestead, Docker, or
|
||||||
|
| even a remote VPS, it will be necessary to specify your path mapping.
|
||||||
|
|
|
||||||
|
| Leaving one, or both of these, empty or null will not trigger the remote
|
||||||
|
| URL changes and Debugbar will treat your editor links as local files.
|
||||||
|
|
|
||||||
|
| "remote_sites_path" is an absolute base path for your sites or projects
|
||||||
|
| in Homestead, Vagrant, Docker, or another remote development server.
|
||||||
|
|
|
||||||
|
| Example value: "/home/vagrant/Code"
|
||||||
|
|
|
||||||
|
| "local_sites_path" is an absolute base path for your sites or projects
|
||||||
|
| on your local computer where your IDE or code editor is running on.
|
||||||
|
|
|
||||||
|
| Example values: "/Users/<name>/Code", "C:\Users\<name>\Documents\Code"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'remote_sites_path' => env('DEBUGBAR_REMOTE_SITES_PATH', ''),
|
||||||
|
'local_sites_path' => env('DEBUGBAR_LOCAL_SITES_PATH', ''),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Vendors
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Vendor files are included by default, but can be set to false.
|
||||||
|
| This can also be set to 'js' or 'css', to only include javascript or css vendor files.
|
||||||
|
| Vendor files are for css: font-awesome (including fonts) and highlight.js (css files)
|
||||||
|
| and for js: jquery and highlight.js
|
||||||
|
| So if you want syntax highlighting, set it to true.
|
||||||
|
| jQuery is set to not conflict with existing jQuery scripts.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'include_vendors' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Capture Ajax Requests
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The Debugbar can capture Ajax requests and display them. If you don't want this (ie. because of errors),
|
||||||
|
| you can use this option to disable sending the data through the headers.
|
||||||
|
|
|
||||||
|
| Optionally, you can also send ServerTiming headers on ajax requests for the Chrome DevTools.
|
||||||
|
|
|
||||||
|
| Note for your request to be identified as ajax requests they must either send the header
|
||||||
|
| X-Requested-With with the value XMLHttpRequest (most JS libraries send this), or have application/json as a Accept header.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'capture_ajax' => true,
|
||||||
|
'add_ajax_timing' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Custom Error Handler for Deprecated warnings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When enabled, the Debugbar shows deprecated warnings for Symfony components
|
||||||
|
| in the Messages tab.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'error_handler' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Clockwork integration
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The Debugbar can emulate the Clockwork headers, so you can use the Chrome
|
||||||
|
| Extension, without the server-side code. It uses Debugbar collectors instead.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'clockwork' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DataCollectors
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Enable/disable DataCollectors
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'collectors' => [
|
||||||
|
'phpinfo' => true, // Php version
|
||||||
|
'messages' => true, // Messages
|
||||||
|
'time' => true, // Time Datalogger
|
||||||
|
'memory' => true, // Memory usage
|
||||||
|
'exceptions' => true, // Exception displayer
|
||||||
|
'log' => true, // Logs from Monolog (merged in messages if enabled)
|
||||||
|
'db' => true, // Show database (PDO) queries and bindings
|
||||||
|
'views' => true, // Views with their data
|
||||||
|
'route' => true, // Current route information
|
||||||
|
'auth' => false, // Display Laravel authentication status
|
||||||
|
'gate' => true, // Display Laravel Gate checks
|
||||||
|
'session' => true, // Display session data
|
||||||
|
'symfony_request' => true, // Only one can be enabled..
|
||||||
|
'mail' => true, // Catch mail messages
|
||||||
|
'laravel' => false, // Laravel version and environment
|
||||||
|
'events' => false, // All events fired
|
||||||
|
'default_request' => false, // Regular or special Symfony request logger
|
||||||
|
'logs' => false, // Add the latest log messages
|
||||||
|
'files' => false, // Show the included files
|
||||||
|
'config' => false, // Display config settings
|
||||||
|
'cache' => false, // Display cache events
|
||||||
|
'models' => true, // Display models
|
||||||
|
'livewire' => true, // Display Livewire (when available)
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Extra options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Configure some DataCollectors
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'options' => [
|
||||||
|
'auth' => [
|
||||||
|
'show_name' => true, // Also show the users name/email in the debugbar
|
||||||
|
],
|
||||||
|
'db' => [
|
||||||
|
'with_params' => true, // Render SQL with the parameters substituted
|
||||||
|
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
|
||||||
|
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
|
||||||
|
'timeline' => false, // Add the queries to the timeline
|
||||||
|
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
|
||||||
|
'explain' => [ // Show EXPLAIN output on queries
|
||||||
|
'enabled' => false,
|
||||||
|
'types' => ['SELECT'], // Deprecated setting, is always only SELECT
|
||||||
|
],
|
||||||
|
'hints' => false, // Show hints for common mistakes
|
||||||
|
'show_copy' => false, // Show copy button next to the query,
|
||||||
|
'slow_threshold' => false, // Only track queries that last longer than this time in ms
|
||||||
|
],
|
||||||
|
'mail' => [
|
||||||
|
'full_log' => false,
|
||||||
|
],
|
||||||
|
'views' => [
|
||||||
|
'timeline' => false, // Add the views to the timeline (Experimental)
|
||||||
|
'data' => false, //Note: Can slow down the application, because the data can be quite large..
|
||||||
|
'exclude_paths' => [], // Add the paths which you don't want to appear in the views
|
||||||
|
],
|
||||||
|
'route' => [
|
||||||
|
'label' => true, // show complete route on bar
|
||||||
|
],
|
||||||
|
'logs' => [
|
||||||
|
'file' => null,
|
||||||
|
],
|
||||||
|
'cache' => [
|
||||||
|
'values' => true, // collect cache values
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Inject Debugbar in Response
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Usually, the debugbar is added just before </body>, by listening to the
|
||||||
|
| Response after the App is done. If you disable this, you have to add them
|
||||||
|
| in your template yourself. See http://phpdebugbar.com/docs/rendering.html
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'inject' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DebugBar route prefix
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Sometimes you want to set route prefix to be used by DebugBar to load
|
||||||
|
| its resources from. Usually the need comes from misconfigured web server or
|
||||||
|
| from trying to overcome bugs like this: http://trac.nginx.org/nginx/ticket/97
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'route_prefix' => '_debugbar',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DebugBar route domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By default DebugBar route served from the same domain that request served.
|
||||||
|
| To override default domain, specify it as a non-empty value.
|
||||||
|
*/
|
||||||
|
'route_domain' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| DebugBar theme
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Switches between light and dark theme. If set to auto it will respect system preferences
|
||||||
|
| Possible values: auto, light, dark
|
||||||
|
*/
|
||||||
|
'theme' => env('DEBUGBAR_THEME', 'auto'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Backtrace stack limit
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By default, the DebugBar limits the number of frames returned by the 'debug_backtrace()' function.
|
||||||
|
| If you need larger stacktraces, you can increase this number. Setting it to 0 will result in no limit.
|
||||||
|
*/
|
||||||
|
'debug_backtrace_limit' => 50,
|
||||||
|
];
|
78
config/filesystems.php
Normal file
78
config/filesystems.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Filesystem Disk
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the default filesystem disk that should be used
|
||||||
|
| by the framework. The "local" disk, as well as a variety of cloud
|
||||||
|
| based disks are available to your application. Just store away!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Filesystem Disks
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||||
|
| may even configure multiple disks of the same driver. Defaults have
|
||||||
|
| been set up for each driver as an example of the required values.
|
||||||
|
|
|
||||||
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disks' => [
|
||||||
|
|
||||||
|
'local' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app'),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'public' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/public/'.env("DEFAULT_STORAGE_PATH")),
|
||||||
|
'url' => env("APP_URL").'/storage/'.env("DEFAULT_STORAGE_PATH"),
|
||||||
|
// 'root' => storage_path('app/public'),
|
||||||
|
// 'url' => env('APP_URL').'/storage',
|
||||||
|
'visibility' => 'public',
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
's3' => [
|
||||||
|
'driver' => 's3',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
|
'bucket' => env('AWS_BUCKET'),
|
||||||
|
'url' => env('AWS_URL'),
|
||||||
|
'endpoint' => env('AWS_ENDPOINT'),
|
||||||
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Symbolic Links
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the symbolic links that will be created when the
|
||||||
|
| `storage:link` Artisan command is executed. The array keys should be
|
||||||
|
| the locations of the links and the values should be their targets.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'links' => [
|
||||||
|
public_path('storage') => storage_path('app/public'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
52
config/hashing.php
Normal file
52
config/hashing.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Hash Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default hash driver that will be used to hash
|
||||||
|
| passwords for your application. By default, the bcrypt algorithm is
|
||||||
|
| used; however, you remain free to modify this option if you wish.
|
||||||
|
|
|
||||||
|
| Supported: "bcrypt", "argon", "argon2id"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => 'bcrypt',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Bcrypt Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'bcrypt' => [
|
||||||
|
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Argon Options
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the configuration options that should be used when
|
||||||
|
| passwords are hashed using the Argon algorithm. These will allow you
|
||||||
|
| to control the amount of time it takes to hash the given password.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'argon' => [
|
||||||
|
'memory' => 65536,
|
||||||
|
'threads' => 1,
|
||||||
|
'time' => 4,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
43
config/installer.php
Normal file
43
config/installer.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Server Requirements
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the default Laravel server requirements, you can add as many
|
||||||
|
| as your application require, we check if the extension is enabled
|
||||||
|
| by looping through the array and run "extension_loaded" on it.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'core' => [
|
||||||
|
'minPhpVersion' => '7.2.5'
|
||||||
|
],
|
||||||
|
|
||||||
|
'requirements' => [
|
||||||
|
'openssl',
|
||||||
|
'pdo',
|
||||||
|
'mbstring',
|
||||||
|
'tokenizer',
|
||||||
|
'fileinfo',
|
||||||
|
'curl'
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Folders Permissions
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This is the default Laravel folders permissions, if your application
|
||||||
|
| requires more permissions just add them to the array list bellow.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'permissions' => [
|
||||||
|
'storage/app/' => '775',
|
||||||
|
'storage/framework/' => '775',
|
||||||
|
'storage/logs/' => '775',
|
||||||
|
'bootstrap/cache/' => '775'
|
||||||
|
]
|
||||||
|
];
|
180
config/lfm.php
Normal file
180
config/lfm.php
Normal file
@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Documentation for this config :
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| online => http://unisharp.github.io/laravel-filemanager/config
|
||||||
|
| offline => vendor/unisharp/laravel-filemanager/docs/config.md
|
||||||
|
*/
|
||||||
|
|
||||||
|
return [
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Routing
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
'base_directory' => env('DEFAULT_STORAGE_PATH', 'public/files'),
|
||||||
|
|
||||||
|
'use_package_routes' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Shared folder / Private folder
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If both options are set to false, then shared folder will be activated.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'allow_private_folder' => true,
|
||||||
|
|
||||||
|
// Flexible way to customize client folders accessibility
|
||||||
|
// If you want to customize client folders, publish tag="lfm_handler"
|
||||||
|
// Then you can rewrite userField function in App\Handler\ConfigHandler class
|
||||||
|
// And set 'user_field' to App\Handler\ConfigHandler::class
|
||||||
|
// Ex: The private folder of user will be named as the user id.
|
||||||
|
'private_folder_name' => UniSharp\LaravelFilemanager\Handlers\ConfigHandler::class,
|
||||||
|
|
||||||
|
'allow_shared_folder' => true,
|
||||||
|
|
||||||
|
'shared_folder_name' => 'shares',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Folder Names
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
'folder_categories' => [
|
||||||
|
'file' => [
|
||||||
|
'folder_name' => 'files',
|
||||||
|
'startup_view' => 'list',
|
||||||
|
'max_size' => 50000, // size in KB
|
||||||
|
'thumb' => true,
|
||||||
|
'thumb_width' => 80,
|
||||||
|
'thumb_height' => 80,
|
||||||
|
'valid_mime' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
'image/png',
|
||||||
|
'image/gif',
|
||||||
|
'application/pdf',
|
||||||
|
'text/plain',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'image' => [
|
||||||
|
'folder_name' => 'photos',
|
||||||
|
'startup_view' => 'grid',
|
||||||
|
'max_size' => 50000, // size in KB
|
||||||
|
'thumb' => true,
|
||||||
|
'thumb_width' => 80,
|
||||||
|
'thumb_height' => 80,
|
||||||
|
'valid_mime' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
'image/png',
|
||||||
|
'image/gif',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Pagination
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paginator' => [
|
||||||
|
'perPage' => 30,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Upload / Validation
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
'disk' => 'public',
|
||||||
|
|
||||||
|
'rename_file' => false,
|
||||||
|
|
||||||
|
'rename_duplicates' => false,
|
||||||
|
|
||||||
|
'alphanumeric_filename' => false,
|
||||||
|
|
||||||
|
'alphanumeric_directory' => false,
|
||||||
|
|
||||||
|
'should_validate_size' => false,
|
||||||
|
|
||||||
|
'should_validate_mime' => true,
|
||||||
|
|
||||||
|
// behavior on files with identical name
|
||||||
|
// setting it to true cause old file replace with new one
|
||||||
|
// setting it to false show `error-file-exist` error and stop upload
|
||||||
|
'over_write_on_duplicate' => false,
|
||||||
|
|
||||||
|
// mimetypes of executables to prevent from uploading
|
||||||
|
'disallowed_mimetypes' => ['text/x-php', 'text/html', 'text/plain'],
|
||||||
|
|
||||||
|
// Item Columns
|
||||||
|
'item_columns' => ['name', 'url', 'time', 'icon', 'is_file', 'is_image', 'thumb_url'],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Thumbnail
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// If true, image thumbnails would be created during upload
|
||||||
|
'should_create_thumbnails' => true,
|
||||||
|
|
||||||
|
'thumb_folder_name' => 'thumbs',
|
||||||
|
|
||||||
|
// Create thumbnails automatically only for listed types.
|
||||||
|
'raster_mimetypes' => [
|
||||||
|
'image/jpeg',
|
||||||
|
'image/pjpeg',
|
||||||
|
'image/png',
|
||||||
|
],
|
||||||
|
|
||||||
|
'thumb_img_width' => 200, // px
|
||||||
|
|
||||||
|
'thumb_img_height' => 200, // px
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| File Extension Information
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
'file_type_array' => [
|
||||||
|
'pdf' => 'Adobe Acrobat',
|
||||||
|
'doc' => 'Microsoft Word',
|
||||||
|
'docx' => 'Microsoft Word',
|
||||||
|
'xls' => 'Microsoft Excel',
|
||||||
|
'xlsx' => 'Microsoft Excel',
|
||||||
|
'zip' => 'Archive',
|
||||||
|
'gif' => 'GIF Image',
|
||||||
|
'jpg' => 'JPEG Image',
|
||||||
|
'jpeg' => 'JPEG Image',
|
||||||
|
'png' => 'PNG Image',
|
||||||
|
'ppt' => 'Microsoft PowerPoint',
|
||||||
|
'pptx' => 'Microsoft PowerPoint',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| php.ini override
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These values override your php.ini settings before uploading files
|
||||||
|
| Set these to false to ingnore and apply your php.ini settings
|
||||||
|
|
|
||||||
|
| Please note that the 'upload_max_filesize' & 'post_max_size'
|
||||||
|
| directives are not supported.
|
||||||
|
*/
|
||||||
|
'php_ini_overrides' => [
|
||||||
|
'memory_limit' => '256M',
|
||||||
|
],
|
||||||
|
];
|
131
config/logging.php
Normal file
131
config/logging.php
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Handler\NullHandler;
|
||||||
|
use Monolog\Handler\StreamHandler;
|
||||||
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option defines the default log channel that gets used when writing
|
||||||
|
| messages to the logs. The name specified in this option should match
|
||||||
|
| one of the channels defined in the "channels" configuration array.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('LOG_CHANNEL', 'stack'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Deprecations Log Channel
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the log channel that should be used to log warnings
|
||||||
|
| regarding deprecated PHP and library features. This allows you to get
|
||||||
|
| your application ready for upcoming major versions of dependencies.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'deprecations' => [
|
||||||
|
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||||
|
'trace' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Log Channels
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the log channels for your application. Out of
|
||||||
|
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||||
|
| you a variety of powerful log handlers / formatters to utilize.
|
||||||
|
|
|
||||||
|
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||||
|
| "errorlog", "monolog",
|
||||||
|
| "custom", "stack"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'channels' => [
|
||||||
|
'stack' => [
|
||||||
|
'driver' => 'stack',
|
||||||
|
'channels' => ['single'],
|
||||||
|
'ignore_exceptions' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'single' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'daily' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'days' => 14,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'slack' => [
|
||||||
|
'driver' => 'slack',
|
||||||
|
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||||
|
'username' => 'Laravel Log',
|
||||||
|
'emoji' => ':boom:',
|
||||||
|
'level' => env('LOG_LEVEL', 'critical'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'papertrail' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||||
|
'handler_with' => [
|
||||||
|
'host' => env('PAPERTRAIL_URL'),
|
||||||
|
'port' => env('PAPERTRAIL_PORT'),
|
||||||
|
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'stderr' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||||
|
'with' => [
|
||||||
|
'stream' => 'php://stderr',
|
||||||
|
],
|
||||||
|
'processors' => [PsrLogMessageProcessor::class],
|
||||||
|
],
|
||||||
|
|
||||||
|
'syslog' => [
|
||||||
|
'driver' => 'syslog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'facility' => LOG_USER,
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'errorlog' => [
|
||||||
|
'driver' => 'errorlog',
|
||||||
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
'replace_placeholders' => true,
|
||||||
|
],
|
||||||
|
|
||||||
|
'null' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => NullHandler::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
'emergency' => [
|
||||||
|
'path' => storage_path('logs/laravel.log'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
125
config/mail.php
Normal file
125
config/mail.php
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Mailer
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default mailer that is used to send any email
|
||||||
|
| messages sent by your application. Alternative mailers may be setup
|
||||||
|
| and used as needed; however, this mailer will be used by default.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('MAIL_MAILER', 'smtp'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Mailer Configurations
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure all of the mailers used by your application plus
|
||||||
|
| their respective settings. Several examples have been configured for
|
||||||
|
| you and you are free to add your own as your application requires.
|
||||||
|
|
|
||||||
|
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||||
|
| sending an e-mail. You will specify which one you are using for your
|
||||||
|
| mailers below. You are free to add additional mailers as required.
|
||||||
|
|
|
||||||
|
| Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2",
|
||||||
|
| "postmark", "log", "array", "failover"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailers' => [
|
||||||
|
'smtp' => [
|
||||||
|
'transport' => 'smtp',
|
||||||
|
'url' => env('MAIL_URL'),
|
||||||
|
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||||
|
'port' => env('MAIL_PORT', 587),
|
||||||
|
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||||
|
'username' => env('MAIL_USERNAME'),
|
||||||
|
'password' => env('MAIL_PASSWORD'),
|
||||||
|
'timeout' => null,
|
||||||
|
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'transport' => 'ses',
|
||||||
|
],
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'transport' => 'mailgun',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'transport' => 'postmark',
|
||||||
|
// 'client' => [
|
||||||
|
// 'timeout' => 5,
|
||||||
|
// ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'sendmail' => [
|
||||||
|
'transport' => 'sendmail',
|
||||||
|
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'log' => [
|
||||||
|
'transport' => 'log',
|
||||||
|
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'array' => [
|
||||||
|
'transport' => 'array',
|
||||||
|
],
|
||||||
|
|
||||||
|
'failover' => [
|
||||||
|
'transport' => 'failover',
|
||||||
|
'mailers' => [
|
||||||
|
'smtp',
|
||||||
|
'log',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Global "From" Address
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| You may wish for all e-mails sent by your application to be sent from
|
||||||
|
| the same address. Here, you may specify a name and address that is
|
||||||
|
| used globally for all e-mails that are sent by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'from' => [
|
||||||
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||||
|
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Markdown Mail Settings
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| If you are using Markdown based email rendering, you may configure your
|
||||||
|
| theme and component paths here, allowing you to customize the design
|
||||||
|
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'markdown' => [
|
||||||
|
'theme' => 'default',
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views/vendor/mail'),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
109
config/queue.php
Normal file
109
config/queue.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Queue Connection Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Laravel's queue API supports an assortment of back-ends via a single
|
||||||
|
| API, giving you convenient access to each back-end using the same
|
||||||
|
| syntax for every one. Here you may define a default connection.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Queue Connections
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may configure the connection information for each server that
|
||||||
|
| is used by your application. A default configuration has been added
|
||||||
|
| for each back-end shipped with Laravel. You are free to add more.
|
||||||
|
|
|
||||||
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connections' => [
|
||||||
|
|
||||||
|
'sync' => [
|
||||||
|
'driver' => 'sync',
|
||||||
|
],
|
||||||
|
|
||||||
|
'database' => [
|
||||||
|
'driver' => 'database',
|
||||||
|
'table' => 'jobs',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'beanstalkd' => [
|
||||||
|
'driver' => 'beanstalkd',
|
||||||
|
'host' => 'localhost',
|
||||||
|
'queue' => 'default',
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => 0,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'sqs' => [
|
||||||
|
'driver' => 'sqs',
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||||
|
'queue' => env('SQS_QUEUE', 'default'),
|
||||||
|
'suffix' => env('SQS_SUFFIX'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
'redis' => [
|
||||||
|
'driver' => 'redis',
|
||||||
|
'connection' => 'default',
|
||||||
|
'queue' => env('REDIS_QUEUE', 'default'),
|
||||||
|
'retry_after' => 90,
|
||||||
|
'block_for' => null,
|
||||||
|
'after_commit' => false,
|
||||||
|
],
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Job Batching
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The following options configure the database and table that store job
|
||||||
|
| batching information. These options can be updated to any database
|
||||||
|
| connection and table which has been defined by your application.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'batching' => [
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'job_batches',
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Failed Queue Jobs
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These options configure the behavior of failed queue job logging so you
|
||||||
|
| can control which database and table are used to store the jobs that
|
||||||
|
| have failed. You may change them to any database / table you wish.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'failed' => [
|
||||||
|
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||||
|
'database' => env('DB_CONNECTION', 'mysql'),
|
||||||
|
'table' => 'failed_jobs',
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
67
config/sanctum.php
Normal file
67
config/sanctum.php
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Laravel\Sanctum\Sanctum;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Stateful Domains
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Requests from the following domains / hosts will receive stateful API
|
||||||
|
| authentication cookies. Typically, these should include your local
|
||||||
|
| and production domains which access your API via a frontend SPA.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||||
|
'%s%s',
|
||||||
|
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||||
|
Sanctum::currentApplicationUrlWithPort()
|
||||||
|
))),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Guards
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This array contains the authentication guards that will be checked when
|
||||||
|
| Sanctum is trying to authenticate a request. If none of these guards
|
||||||
|
| are able to authenticate the request, Sanctum will use the bearer
|
||||||
|
| token that's present on an incoming request for authentication.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'guard' => ['web'],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Expiration Minutes
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This value controls the number of minutes until an issued token will be
|
||||||
|
| considered expired. If this value is null, personal access tokens do
|
||||||
|
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'expiration' => null,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Sanctum Middleware
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When authenticating your first-party SPA with Sanctum you may need to
|
||||||
|
| customize some of the middleware Sanctum uses while processing the
|
||||||
|
| request. You may change the middleware listed below as required.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'middleware' => [
|
||||||
|
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||||
|
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
34
config/services.php
Normal file
34
config/services.php
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Third Party Services
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This file is for storing the credentials for third party services such
|
||||||
|
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||||
|
| location for this type of information, allowing packages to have
|
||||||
|
| a conventional file to locate the various service credentials.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'mailgun' => [
|
||||||
|
'domain' => env('MAILGUN_DOMAIN'),
|
||||||
|
'secret' => env('MAILGUN_SECRET'),
|
||||||
|
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||||
|
'scheme' => 'https',
|
||||||
|
],
|
||||||
|
|
||||||
|
'postmark' => [
|
||||||
|
'token' => env('POSTMARK_TOKEN'),
|
||||||
|
],
|
||||||
|
|
||||||
|
'ses' => [
|
||||||
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
|
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
201
config/session.php
Normal file
201
config/session.php
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Default Session Driver
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option controls the default session "driver" that will be used on
|
||||||
|
| requests. By default, we will use the lightweight native driver but
|
||||||
|
| you may specify any of the other wonderful drivers provided here.
|
||||||
|
|
|
||||||
|
| Supported: "file", "cookie", "database", "apc",
|
||||||
|
| "memcached", "redis", "dynamodb", "array"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'driver' => env('SESSION_DRIVER', 'file'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Lifetime
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may specify the number of minutes that you wish the session
|
||||||
|
| to be allowed to remain idle before it expires. If you want them
|
||||||
|
| to immediately expire on the browser closing, set that option.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||||
|
|
||||||
|
'expire_on_close' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Encryption
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option allows you to easily specify that all of your session data
|
||||||
|
| should be encrypted before it is stored. All encryption will be run
|
||||||
|
| automatically by Laravel and you can use the Session like normal.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'encrypt' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session File Location
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the native session driver, we need a location where session
|
||||||
|
| files may be stored. A default has been set for you but a different
|
||||||
|
| location may be specified. This is only needed for file sessions.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'files' => storage_path('framework/sessions'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Connection
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" or "redis" session drivers, you may specify a
|
||||||
|
| connection that should be used to manage these sessions. This should
|
||||||
|
| correspond to a connection in your database configuration options.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'connection' => env('SESSION_CONNECTION'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Database Table
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| When using the "database" session driver, you may specify the table we
|
||||||
|
| should use to manage the sessions. Of course, a sensible default is
|
||||||
|
| provided for you; however, you are free to change this as needed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'table' => 'sessions',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cache Store
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| While using one of the framework's cache driven session backends you may
|
||||||
|
| list a cache store that should be used for these sessions. This value
|
||||||
|
| must match with one of the application's configured cache "stores".
|
||||||
|
|
|
||||||
|
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'store' => env('SESSION_STORE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Sweeping Lottery
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Some session drivers must manually sweep their storage location to get
|
||||||
|
| rid of old sessions from storage. Here are the chances that it will
|
||||||
|
| happen on a given request. By default, the odds are 2 out of 100.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'lottery' => [2, 100],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Name
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the name of the cookie used to identify a session
|
||||||
|
| instance by ID. The name specified here will get used every time a
|
||||||
|
| new session cookie is created by the framework for every driver.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'cookie' => env(
|
||||||
|
'SESSION_COOKIE',
|
||||||
|
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||||
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| The session cookie path determines the path for which the cookie will
|
||||||
|
| be regarded as available. Typically, this will be the root path of
|
||||||
|
| your application but you are free to change this when necessary.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'path' => '/',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Session Cookie Domain
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Here you may change the domain of the cookie used to identify a session
|
||||||
|
| in your application. This will determine which domains the cookie is
|
||||||
|
| available to in your application. A sensible default has been set.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'domain' => env('SESSION_DOMAIN'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTPS Only Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| By setting this option to true, session cookies will only be sent back
|
||||||
|
| to the server if the browser has a HTTPS connection. This will keep
|
||||||
|
| the cookie from being sent to you when it can't be done securely.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| HTTP Access Only
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Setting this value to true will prevent JavaScript from accessing the
|
||||||
|
| value of the cookie and the cookie will only be accessible through
|
||||||
|
| the HTTP protocol. You are free to modify this option if needed.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'http_only' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Same-Site Cookies
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines how your cookies behave when cross-site requests
|
||||||
|
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||||
|
| will set this value to "lax" since this is a secure default value.
|
||||||
|
|
|
||||||
|
| Supported: "lax", "strict", "none", null
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'same_site' => 'lax',
|
||||||
|
|
||||||
|
];
|
36
config/view.php
Normal file
36
config/view.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| View Storage Paths
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Most templating systems load templates from disk. Here you may specify
|
||||||
|
| an array of paths that should be checked for your views. Of course
|
||||||
|
| the usual Laravel view path has already been registered for you.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'paths' => [
|
||||||
|
resource_path('views'),
|
||||||
|
],
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Compiled View Path
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This option determines where all the compiled Blade templates will be
|
||||||
|
| stored for your application. Typically, this is within the storage
|
||||||
|
| directory. However, as usual, you are free to change this value.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'compiled' => env(
|
||||||
|
'VIEW_COMPILED_PATH',
|
||||||
|
realpath(storage_path('framework/views'))
|
||||||
|
),
|
||||||
|
|
||||||
|
];
|
BIN
database/.DS_Store
vendored
Normal file
BIN
database/.DS_Store
vendored
Normal file
Binary file not shown.
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.sqlite*
|
38
database/factories/UserFactory.php
Normal file
38
database/factories/UserFactory.php
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||||
|
*/
|
||||||
|
class UserFactory extends Factory
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Define the model's default state.
|
||||||
|
*
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => fake()->name(),
|
||||||
|
'email' => fake()->unique()->safeEmail(),
|
||||||
|
'email_verified_at' => now(),
|
||||||
|
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||||
|
'remember_token' => Str::random(10),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicate that the model's email address should be unverified.
|
||||||
|
*/
|
||||||
|
public function unverified(): static
|
||||||
|
{
|
||||||
|
return $this->state(fn (array $attributes) => [
|
||||||
|
'email_verified_at' => null,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('accridations', function (Blueprint $table) {
|
||||||
|
$table->id('accridiation_id');
|
||||||
|
$table->string('display')->nullable();
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
$table->text('text')->nullable();
|
||||||
|
$table->string('image')->nullable();
|
||||||
|
$table->string('thumb')->nullable();
|
||||||
|
$table->string('cover')->nullable();
|
||||||
|
$table->integer('display_order')->nullable();
|
||||||
|
$table->integer('status')->nullable();
|
||||||
|
$table->integer('created_by')->nullable();
|
||||||
|
$table->integer('updated_by')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('accridations');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('activity_logs', function (Blueprint $table) {
|
||||||
|
$table->id('activity_id');
|
||||||
|
$table->integer('user_id')->nullable();
|
||||||
|
$table->string('controllerName')->nullable();
|
||||||
|
$table->string('methodName')->nullable();
|
||||||
|
$table->string('actionUrl')->nullable();
|
||||||
|
$table->string('activity')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('activity_logs');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('articles', function (Blueprint $table) {
|
||||||
|
$table->id('article_id');
|
||||||
|
$table->integer('parent_article')->default(0);
|
||||||
|
$table->string('title', 250)->nullable();
|
||||||
|
$table->text('subtitle')->nullable();
|
||||||
|
$table->string('alias', 250)->nullable();
|
||||||
|
$table->text('text')->nullable();
|
||||||
|
$table->string('cover_photo', 500)->nullable();
|
||||||
|
$table->string('thumb', 255)->nullable();
|
||||||
|
$table->integer('display_order')->default(1);
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->text('seo_keywords')->nullable();
|
||||||
|
$table->text('seo_title')->nullable();
|
||||||
|
$table->text('seo_descriptions')->nullable();
|
||||||
|
$table->text('og_tags')->nullable();
|
||||||
|
$table->integer('createdby')->nullable();
|
||||||
|
$table->integer('updatedby')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('articles');
|
||||||
|
}
|
||||||
|
};
|
42
database/migrations/2024_06_10_073647_create_tbl_blogs.php
Normal file
42
database/migrations/2024_06_10_073647_create_tbl_blogs.php
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('blogs', function (Blueprint $table) {
|
||||||
|
$table->id('blog_id');
|
||||||
|
$table->integer('parent_blog')->default(0);
|
||||||
|
$table->string('title', 250)->nullable();
|
||||||
|
$table->string('alias', 250)->nullable();
|
||||||
|
$table->text('text')->nullable();
|
||||||
|
$table->string('image', 255)->nullable();
|
||||||
|
$table->string('thumb', 255)->nullable();
|
||||||
|
$table->string('cover', 255)->nullable();
|
||||||
|
$table->integer('display_order')->default(1);
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->integer('createdby')->nullable();
|
||||||
|
$table->integer('updatedby')->nullable();
|
||||||
|
$table->text('seo_keywords')->nullable();
|
||||||
|
$table->text('seo_title')->nullable();
|
||||||
|
$table->text('seo_descriptions')->nullable();
|
||||||
|
$table->text('og_tags')->nullable();
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('blogs');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('branches', function (Blueprint $table) {
|
||||||
|
$table->id('branch_id');
|
||||||
|
$table->string('parent_branch', 255)->nullable()->default(null);
|
||||||
|
$table->string('title', 255)->nullable()->default(null);
|
||||||
|
$table->string('alias', 255)->nullable()->default(null);
|
||||||
|
$table->string('contact_person', 250)->nullable()->default(null);
|
||||||
|
$table->string('designation', 250)->nullable()->default(null);
|
||||||
|
$table->text('text')->nullable()->default(null);
|
||||||
|
$table->string('cover_photo', 255)->nullable()->default(null);
|
||||||
|
$table->string('thumb', 255)->nullable()->default(null);
|
||||||
|
$table->text('description')->nullable()->default(null);
|
||||||
|
$table->string('contact1', 250)->nullable()->default(null);
|
||||||
|
$table->string('contact2', 250)->nullable()->default(null);
|
||||||
|
$table->string('email', 250)->nullable()->default(null);
|
||||||
|
$table->text('address')->nullable()->default(null);
|
||||||
|
$table->text('google_map')->nullable()->default(null);
|
||||||
|
$table->integer('display_order')->nullable()->default(null);
|
||||||
|
$table->integer('status')->nullable()->default(null);
|
||||||
|
$table->text('seo_keywords')->nullable()->default(null);
|
||||||
|
$table->text('seo_title')->nullable()->default(null);
|
||||||
|
$table->text('seo_description')->nullable()->default(null);
|
||||||
|
$table->text('og_tags')->nullable()->default(null);
|
||||||
|
$table->integer('createdby')->nullable()->default(null);
|
||||||
|
$table->integer('updatedby')->nullable()->default(null);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('branches');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('certificates', function (Blueprint $table) {
|
||||||
|
$table->id('certificate_id');
|
||||||
|
$table->string('title', 255)->nullable()->default(null);
|
||||||
|
$table->string('alias', 255)->nullable()->default(null);
|
||||||
|
$table->string('photo', 255)->nullable()->default(null);
|
||||||
|
$table->string('thumb', 255)->nullable()->default(null);
|
||||||
|
$table->string('text', 255)->nullable()->default(null);
|
||||||
|
$table->text('description')->nullable()->default(null);
|
||||||
|
$table->integer('display_order')->nullable()->default(null);
|
||||||
|
$table->integer('status')->nullable()->default(null);
|
||||||
|
$table->timestamps();
|
||||||
|
$table->integer('createdby')->nullable()->default(null);
|
||||||
|
$table->integer('updatedby')->nullable()->default(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('certificates');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('contacts', function (Blueprint $table) {
|
||||||
|
$table->id('contact_id');
|
||||||
|
$table->integer('forms_id')->nullable();
|
||||||
|
$table->integer('branches_id')->nullable();
|
||||||
|
$table->string('name', 255)->nullable()->default(null);
|
||||||
|
$table->string('tagline', 255)->nullable()->default(null);
|
||||||
|
$table->string('address', 255)->nullable()->default(null);
|
||||||
|
$table->string('tel', 20);
|
||||||
|
$table->string('fax', 255)->nullable()->default(null);
|
||||||
|
$table->string('email1', 255)->nullable()->default(null);
|
||||||
|
$table->string('email2', 255)->nullable()->default(null);
|
||||||
|
$table->string('website', 255)->nullable()->default(null);
|
||||||
|
$table->text('google_map')->nullable()->default(null);
|
||||||
|
$table->string('facebook', 50)->nullable();
|
||||||
|
$table->string('hp1', 50)->nullable();
|
||||||
|
$table->string('hp2', 50)->nullable();
|
||||||
|
$table->integer('display_order')->default(1);
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->text('remarks')->nullable()->default(null);
|
||||||
|
$table->timestamps();
|
||||||
|
$table->integer('createdby')->nullable()->default(null);
|
||||||
|
$table->integer('updatedby')->nullable()->default(null);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('contacts');
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('countries', function (Blueprint $table) {
|
||||||
|
$table->id('country_id');
|
||||||
|
$table->string('title', 255)->nullable()->default(null);
|
||||||
|
$table->string('alias', 255)->nullable()->default(null);
|
||||||
|
$table->text('text')->nullable()->default(null);
|
||||||
|
$table->text('details')->nullable()->default(null);
|
||||||
|
$table->string('cover_photo', 255)->nullable()->default(null);
|
||||||
|
$table->text('feature')->nullable()->default(null);
|
||||||
|
$table->string('image_thumb', 255)->nullable()->default(null);
|
||||||
|
$table->integer('display_order')->default(1);
|
||||||
|
$table->integer('status')->default(1);
|
||||||
|
$table->text('seo_keywords')->nullable()->default(null);
|
||||||
|
$table->text('seo_title')->nullable()->default(null);
|
||||||
|
$table->text('seo_descriptions')->nullable()->default(null);
|
||||||
|
$table->text('og_tags')->nullable()->default(null);
|
||||||
|
$table->integer('createdby')->nullable()->default(null);
|
||||||
|
$table->integer('updatedby')->nullable()->default(null);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('countries');
|
||||||
|
}
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user