File::put PHP Method

put() public static method

Write the contents of a file.
public static put ( string $path, string $contents, boolean $lock = false ) : integer
$path string
$contents string
$lock boolean
return integer
        public static function put($path, $contents, $lock = false)
        {
            return \Illuminate\Filesystem\Filesystem::put($path, $contents, $lock);
        }

Usage Example

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $path = $this->getFilePath();
     $directory = dirname($path);
     if ($this->file->exists($path)) {
         $this->error("A view already exists at {$path}!");
         return false;
     }
     if (!$this->file->exists($directory)) {
         $this->file->makeDirectory($directory, 0777, true);
     }
     $this->file->put($path, $this->getViewContents());
     $this->info("Created a new view at {$path}");
 }
All Usage Examples Of File::put