One Hat Cyber Team
Your IP :
216.73.217.126
Server IP :
185.33.55.30
Server :
Linux cl30.webspacecontrol.com 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64
Server Software :
Apache
PHP Version :
8.1.34
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
esetkocsi
/
public_html
/
app
/
Console
/
Commands
/
View File Name :
CreateView.php
<?php namespace App\Console\Commands; use Illuminate\Console\Command; use Illuminate\Support\Facades\File; class CreateView extends Command { protected $signature = 'make:view {--path=} {name} {--extend=} {--sections=} {--yields=} {--includes=}'; protected $description = 'Create a Blade view file'; public function __construct() { parent::__construct(); } public function handle() { $name = $this->argument('name'); $path = $this->option('path') ? $this->option('path') . '/' : ''; $viewPath = resource_path("views/$path$name.blade.php"); $extends = $this->option('extend'); $section = $this->option('sections') ? explode(',', $this->option('sections')) : []; $yield = $this->option('yields') ? explode(',', $this->option('yields')) : []; $include = $this->option('includes') ? explode(',', $this->option('includes')) : []; // Check if the folder path exists, and create it if necessary $folderPath = resource_path("views/$path"); if (!File::isDirectory($folderPath)) { File::makeDirectory($folderPath, 0755, true, true); } if (File::exists($viewPath)) { $this->error('View already exists!'); return; } // Create the view file File::put($viewPath, ''); // If the --extend option is provided, add the @extends directive if ($extends) { File::prepend($viewPath, "@extends('$extends')\n"); } if ($include) { foreach ($include as $incl) { File::append($viewPath, "@include('elements/$incl')\n"); } } // If the --section option is provided, add a section definition if ($section) { foreach ($section as $sect) { File::append($viewPath, "\n@section('$sect')\n\n@endsection"); } } if ($yield) { foreach ($yield as $yiel) { File::append($viewPath, "@yield('$yiel')\n"); } } $this->info('View created successfully.'); } }