本文整理汇总了PHP中Illuminate\Support\Facades\Storage::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::delete方法的具体用法?PHP Storage::delete怎么用?PHP Storage::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Storage
的用法示例。
在下文中一共展示了Storage::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: excluir
public function excluir($id)
{
$this->post = Post::where('id', $id)->first();
Storage::delete($this->post->id . '.jpg');
$this->post->delete();
return redirect()->route('dashboard');
}
示例2: retrieveFile
public function retrieveFile(Submission $submissions, $file)
{
$form = $submissions->formdefinition()->first();
if ($submissions->group()->users()->get()->contains(Auth::user())) {
//$file = Storage::get("form/".$form->id."/".$file);
$filepath = "form/" . $form->id . "/" . $file;
//Storage::get(form/)
// if(Storage::exists($filepath)){
/* if(copy($filepath,"/var/www/calwebtool/public/downloads/".$file)){
return respones()->file("downloads/".$file);
}
//Storage::copy($filepath,"downloads/".$file);
return response()->file("downloads/".$file);
//}
/*else{
flash()->overlay("The file does not exist.","Not Found");
return redirect()->back();
}*/
if (Storage::exists($filepath)) {
if (Storage::exists("downloads/" . $file)) {
Storage::delete("downloads/" . $file);
}
Storage::copy($filepath, "downloads/" . $file);
return response()->download("downloads/" . $file);
}
}
}
示例3: destroyFile
/**
* Destroy file
* Path is relative to /app directory
*
* @param $filenamepath
*/
public function destroyFile($filenamepath)
{
if (Storage::has($filenamepath)) {
return Storage::delete($filenamepath);
}
return true;
}
示例4: delete
/**
* @param $id
* @return array
*/
public function delete($id)
{
$obj = $this->rep->find($id);
if (Storage::exists($obj->id . '.' . $obj->extension)) {
Storage::delete($obj->id . '.' . $obj->extension);
}
return parent::delete($id);
}
示例5: excluir
public function excluir($id)
{
$aviso = new Aviso();
$aviso = Aviso::where('id', $id)->first();
$aviso->delete();
Storage::delete($aviso->id . 'aviso.jpg');
return redirect()->route('avisos');
}
示例6: isFileExist
protected function isFileExist()
{
$oe = $this->info->containmentAction->objective_evidence;
if ($this->isNotEmpty($this->info->containmentAction) && $this->isExist($this->directory($oe))) {
Storage::delete($this->directory($oe));
}
return $this;
}
示例7: delete
public function delete($filename, $isLocal = false)
{
if ($isLocal) {
File::delete(storage_path('app') . '/' . config('images.path') . $filename);
} else {
Storage::delete(config('images.path') . $filename);
}
}
示例8: deleteFile
public function deleteFile($id)
{
$pf = $this->repository->find($id);
$filename = $pf->name . "." . $pf->extension;
if (Storage::exists($filename) && $this->delete($id)) {
return Storage::delete($filename);
}
return true;
}
示例9: boot
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$configPath = __DIR__ . '/config/connectionloader.php';
$migrationPath = __DIR__ . '/migration/2016_05_02_000000_create_connection_loader_table.php';
/**
* Copy the default configuration file and migration file when user runs php artisan vendor:publish
*/
$this->publishes([$configPath => config_path('/connectionloader.php')], 'config');
$this->publishes([$migrationPath => database_path('/migrations/2016_05_02_000000_create_connection_loader_table.php')], 'migration');
if ($this->app['config']->get('connectionloader.enabled')) {
if (!$this->app['config']->get('connectionloader.enabled')) {
return;
}
$connection = $this->app['config']->get('connectionloader.connection');
$table = $this->app['config']->get('connectionloader.table');
$check = $this->app['config']->get('connectionloader.check_enabled');
if (!(isset($connection) && isset($table) && isset($check))) {
\error_log('Invalid connection or table specified in configuration file');
return;
}
/**
* Function to gather database connections from database and table provided
* in configuration file. Compiles into file that returns an array.
* Function returns path to the temporary file.
*/
$fileName = ConnectionLoader::getConnections($connection, $table);
if ($fileName == null) {
\error_log('Error in returned file name value');
return;
}
$file_path = storage_path('app/' . $fileName);
/**
* Merge the returned configuration array into the existing database.connections
* configuration key.
*/
$key = 'database.connections';
$config = $this->app['config']->get($key, []);
$configSet = $this->app['config']->set($key, array_merge(require $file_path, $config));
/**
* Now to delete the temporary file created during the process
*/
$result = Storage::delete($fileName);
if ($result === false) {
\error_log('Failed to delete ' . storage_path() . $fileName);
\error_log('Trying once more');
$result = Storage::delete($fileName);
if ($result === true) {
\error_log(storage_path() . $fileName . ' Deleted successfully');
return;
}
\error_log('Failed to delete twice, delete manually ' . storage_path() . $fileName);
return;
}
ConnectionLoader::checkConnections($connection, $table, $check);
}
}
示例10: postEliminar
public function postEliminar()
{
$id = Input::get('id');
$medio = Input::get('medio');
if (Storage::exists($medio)) {
Storage::delete($medio);
}
Medio::find(Input::get('id'))->fill(Input::all())->delete();
return response()->json(["mensaje" => "eliminado"]);
}
示例11: deleteApoyo
public function deleteApoyo($filename)
{
$archivo = $this->descargar($filename);
$exists = Storage::disk('local')->exists($archivo->filename);
if ($exists) {
Storage::delete($archivo->filename);
$archivo->delete();
flash()->overlay('Ha sido borrado sactifactoriamente', 'El archivo ' . $archivo->filename);
}
}
示例12: borrar
public function borrar($filename)
{
$archivo = Fileentry::where('filename', '=', $filename)->firstOrFail();
$exists = Storage::disk('local')->exists($archivo->filename);
if ($exists) {
Storage::delete($archivo->filename);
$archivo->delete();
flash()->overlay('Ha sido borrado sactifactoriamente', 'El archivo ' . $archivo->filename);
}
}
示例13: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
// IF there is a previously uploaded award image file, delete it
if (Session::has('award_image_upload')) {
Storage::delete(storage_path('app\\uploads') . '\\' . Session::get('award_image_upload'));
Session::delete('award_image_upload');
}
$award = Award::findOrFail($id);
return view('award.edit')->with('award', $award);
}
示例14: destroy
public function destroy($id)
{
$store = Store::find($id);
if ($store->file_entries_id !== 0) {
$entry = FileEntry::find($store->file_entries_id);
Storage::delete($entry->filename);
$entry->delete();
}
$store->delete();
return response()->json(['id' => $id]);
}
示例15: RemoveColumnAudioSample
public function RemoveColumnAudioSample($syllabaryId, $columnId)
{
$column = SyllabaryColumnHeader::where('syllabary_id', '=', $syllabaryId)->where('id', '=', $columnId)->first();
try {
Storage::delete($column->audio_sample);
} catch (\Exception $e) {
}
$column->audio_sample = null;
$column->save();
return redirect()->back();
}