本文整理汇总了PHP中Storage::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Storage::delete方法的具体用法?PHP Storage::delete怎么用?PHP Storage::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Storage
的用法示例。
在下文中一共展示了Storage::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDeleteCompositeKey
public function testDeleteCompositeKey()
{
if (!$this->storage->supportsCompositePrimaryKeys()) {
$this->markTestSkipped('Composite keys need to be supported for this test to run.');
}
$key = ['dist' => 'foo', 'range' => 100];
$this->mockDeleteCompositeKey($key);
$this->storage->delete('stdClass', $key);
}
示例2: destroyPdf
public function destroyPdf($id)
{
$pdfs = Pdf::findOrFail($id);
$pdfs->delete();
\Storage::delete($pdfs->nombre);
return "El PDF : " . $pdfs->nombre . " fue eliminado";
}
示例3: postFileDestroy
public function postFileDestroy(Request $request)
{
$documentoP = DocumentoAdjunto::findOrFail($request->get('key'));
\Storage::delete($documentoP->path);
$documentoP->delete();
return response()->json(['message' => 'El documento se ha eliminado exitosamente.']);
}
开发者ID:elNapoli,项目名称:iCnca7CrTNYXRF4oxPSidusv17MoVk7CEAhNGFGcYHSu0DNSy7Hkq,代码行数:7,代码来源:DocumentosPostulacionController.php
示例4: destroy
public function destroy($id)
{
\Storage::delete(Producto::find($id)->foto);
Producto::destroy($id);
Session::flash('message', 'Producto Eliminado');
return Redirect::to('/product');
}
示例5: store
public function store(Request $request)
{
//dd('jajaja');
$file = $request->file('file');
//obtenemos el campo file obtenido por el formulario
$nombre = $file->getClientOriginalName();
//indicamos que queremos guardar un nuevo archivo en el disco local
\Storage::disk('local')->put($nombre, \File::get($file));
$campus = $request->get('campus');
$tipos = $request->get('tipos');
\Excel::load('/storage/public/files/' . $nombre, function ($archivo) use($campus, $tipos) {
$result = $archivo->get();
//leer todas las filas del archivo
foreach ($result as $key => $value) {
$campus = Campus::whereNombre($value->campus_id)->pluck('id');
$tipos = TipoSala::whereNombre($value->tipo_sala_id)->pluck('id');
//echo $facultades."<br>";
if (is_null($campus)) {
// El campus no existe, deberia hacer algo para mitigar esto, o retornarlo al usuario ...
}
if (is_null($tipos)) {
// El campus no existe, deberia hacer algo para mitigar esto, o retornarlo al usuario ...
}
//if(!Sala::whereNombre('campus_id',$campus)->whereNombre('tipo_sala_id',$tipos)->first()){
if (!Sala::where('nombre', $value->nombre)->first()) {
$var = new Sala();
$var->fill(['nombre' => $value->nombre, 'descripcion' => $value->descripcion, 'capacidad' => $value->capacidad, 'campus_id' => $campus, 'tipo_sala_id' => $tipos]);
$var->save();
}
}
})->get();
\Storage::delete($nombre);
Session::flash('message', 'Las Salas fueron agregadas exitosamente!');
return redirect()->route('Encargado.salas.index');
}
示例6: destroy
public function destroy($id)
{
\Storage::delete(Bodega::find($id)->foto);
Bodega::destroy($id);
Session::flash('message', 'Bodega Eliminada');
return Redirect::to('/bodega');
}
示例7: __construct
public function __construct($args)
{
//$script = file_get_contents(LIB . "/OrongoScript/Tests/test.osc");
//$parser = new OrongoScriptParser($script);
//$parser->startParser();
require 'TerminalPlugin.php';
Plugin::hookTerminalPlugin(new TerminalPlugin());
$stored = Plugin::getSettings($args['auth_key']);
//Access the settings in the array.
if (isset($stored['example_setting_2']) && $stored['example_setting_2']) {
$this->injectHTML = true;
$this->htmlToInject = $stored['example_setting_1'];
} else {
$this->injectHTML = false;
}
$store_string = 'this is a variable';
$bool = Storage::store('a_storage_key', $store_string, true);
if ($bool) {
//This will fail and return false, because overwrite = false
$bool2 = Storage::store('a_storage_key', 'will this overwrite?', false);
if ($bool2 == false) {
//This wil return: this is a variable
$returnString = Storage::get('a_storage_key');
//Delete the storage
Storage::delete('a_storage_key');
}
}
}
示例8: store
public function store(Request $request)
{
//dd('jajaja');
$file = $request->file('file');
//obtenemos el campo file obtenido por el formulario
$nombre = $file->getClientOriginalName();
//indicamos que queremos guardar un nuevo archivo en el disco local
\Storage::disk('local')->put($nombre, \File::get($file));
\Excel::load('/storage/public/files/' . $nombre, function ($archivo) use(&$falla) {
$result = $archivo->get();
//leer todas las filas del archivo
foreach ($result as $key => $value) {
$var = new Periodo();
$datos = ['bloque' => $value->bloque, 'inicio' => $value->inicio, 'fin' => $value->fin];
$validator = Validator::make($datos, Periodo::storeRules());
if ($validator->fails()) {
Session::flash('message', 'Los Periodos ya existen o el archivo ingresado no es valido');
$falla = true;
} else {
$var->fill($datos);
$var->save();
}
}
})->get();
if ($falla) {
// Fallo la validacion de algun campus, retornar al index con mensaje
return redirect()->route('Administrador.periodos.index');
}
\Storage::delete($nombre);
Session::flash('message', 'Los Periodos fueron agregados exitosamente!');
return redirect()->route('Administrador.periodos.index');
}
示例9: testDeleteCallsRedisDeleteMethod
public function testDeleteCallsRedisDeleteMethod()
{
$redis = $this->getMockBuilder('\\Redis')->getMock();
$redis->expects($this->once())->method('delete')->with('prefix:key')->willReturn(true);
$storage = new Storage($redis, 'prefix');
$this->assertTrue($storage->delete('key'));
}
示例10: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Suppression préalable des fichiers de upload par l'utilisation de la variable storage définie à l'aide de l'instruction public_path('upload') du fichier de configuration config\filesystem.php)
$files = Storage::allFiles();
//retroune un tableau des images de storage
foreach ($files as $file) {
Storage::delete($file);
}
//Supprimer toutes les lignes de la talble Pictures
// DB::table('pictures')->
// Récupération d'un faker opétationnel
// $faker = Faker\Factory::create();
$products = Product::all();
foreach ($products as $product) {
// Stokage de l'image et récupération de l'uri
$uri = str_random(15) . '_370x235.jpg';
Storage::put($uri, file_get_contents('http://lorempixel.com/people/370/325/'));
Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
}
// DB::table('pictures')->insert(
// [
// [
// 'product_id' => '2' ,
// 'uri' => $uri
// ],
// ]
// );
}
示例11: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
// If DB file exists delete it
if (Storage::exists(database_path('SPGProfileDB.sqlite'))) {
Storage::delete(database_path('SPGProfileDB.sqlite'));
}
Schema::connection($this->TargetDB)->drop('pass_profiles');
}
开发者ID:Dev1436,项目名称:laravel-securepassgen,代码行数:13,代码来源:2015_12_12_012546_create_pass_profiles_table.php
示例12: delete
public function delete($projectId, $id)
{
try {
$projectFile = $this->repository->find($id);
if ($this->storage->exists($projectFile->getFileName())) {
$this->storage->delete($projectFile->getFileName());
}
$this->repository->delete($id);
return ['success' => true, "message" => 'Registro excluído com sucesso.'];
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Registro não encontrado.', "messageDev" => $e->getMessage()];
} catch (QueryException $e) {
return ['error' => true, 'message' => 'Este registro não pode ser excluído, pois existe um ou mais projetos vinculados a ele.', "messageDev" => $e->getMessage()];
} catch (\Exception $e) {
return ["error" => true, "message" => 'Falha ao excluir registro.', "messageDev" => $e->getMessage()];
}
}
示例13: remove_hook
/**
* @brief Erase versions of deleted file
* @param array
*
* This function is connected to the delete signal of OC_Filesystem
* cleanup the versions directory if the actual file gets deleted
*/
public static function remove_hook($params)
{
if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
$path = $params[\OC\Files\Filesystem::signal_param_path];
if ($path != '') {
Storage::delete($path);
}
}
}
示例14: clearScreenshotFolder
/**
* Clear out all screenshots from the screenshot directory
* TODO: Should be removed, as soon as the virtual-filesystem is integrated
*/
protected function clearScreenshotFolder()
{
$screenshot = app()->make(Screeenly\Core\Screeenshot\Screenshot::class);
$path = $screenshot->setStoragePath();
$files = \Storage::files($path);
array_filter($files, function ($file) {
\Storage::delete($file);
});
}
示例15: remove_hook
/**
* Erase versions of deleted file
* @param array $params
*
* This function is connected to the delete signal of OC_Filesystem
* cleanup the versions directory if the actual file gets deleted
*/
public static function remove_hook($params)
{
if (\OCP\App::isEnabled('files_versions')) {
$path = $params[\OC\Files\Filesystem::signal_param_path];
if ($path != '') {
Storage::delete($path);
}
}
}