los proyectos ya no tienen imaganes que subir, lo debo hacer externamente

This commit is contained in:
Daniel Cortés
2019-10-14 12:14:17 -03:00
parent 82973e7ca8
commit 01c7a4492b
4 changed files with 1 additions and 48 deletions

View File

@@ -27,15 +27,6 @@ class ProjectController extends Controller
$project->md = $request->md;
$project->save();
foreach($request->photos as $photo){
$filename = $photo->store('photos');
$projectPhoto = new ProjectPhoto();
$projectPhoto->project_id = $project->id;
$projectPhoto->filename = $filename;
$projectPhoto->save();
}
return redirect()->route('admin.project.index');
}
@@ -51,33 +42,12 @@ class ProjectController extends Controller
$project->md = $request->md;
$project->save();
foreach($project->photos as $photo) {
Storage::delete($photo->filename);
$photo->delete();
}
foreach($request->photos as $photo){
$filename = $photo->store('photos');
$projectPhoto = new ProjectPhoto();
$projectPhoto->project_id = $project->id;
$projectPhoto->filename = $filename;
$projectPhoto->save();
}
return redirect()->route('admin.project.index');
}
public function delete($id)
{
$project = Project::find($id);
foreach($project->photos as $photo) {
Storage::delete($photo->filename);
$photo->delete();
}
$project->delete();
Project::find($id)->delete();
return redirect()->route('admin.project.index');
}
}

View File

@@ -27,19 +27,10 @@ class CreateBaseDb extends Migration
$table->longText('md');
$table->timestamps();
});
Schema::create('projects_photos', function(Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('project_id')->unsigned();
$table->foreign('project_id')->references('id')->on('projects');
$table->string('filename');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('projects_photos');
Schema::dropIfExists('projects');
Schema::dropIfExists('now');
Schema::dropIfExists('posts');

View File

@@ -17,9 +17,6 @@
<label for="md">Descripcion</label>
<textarea id="md" name="md"></textarea>
<label for="photos">Fotos</label>
<input multiple="multiple" id="photos" name="photos[]" type="file">
<div class="control">
<button class="pure-button button-black-white" type="submit">Crear</button>
</div>

View File

@@ -13,11 +13,6 @@
{!! $parse->text($project->md) !!}
<div class="image-container">
@foreach($project->photos as $photo)
<img src="{{ Storage::url($photo->filename) }}"/>
@endforeach
</div>
</section>
@endforeach
<hr/>