v0.8.3 - Added uploade images function

This commit is contained in:
2020-08-12 12:28:05 +02:00
parent 9c26526740
commit e080b69d98
14 changed files with 83 additions and 21 deletions
+1 -1
View File
@@ -20,6 +20,6 @@ class Event extends Model
*/
//protected variable which contains name of database field(s) to be filled.
protected $fillable = [
"name", "accountable", "description", "date"
"name", "accountable", "description", "date", "resource_id"
];
}
@@ -74,6 +74,10 @@ class EventController extends Controller
if(count($allEvents) > 0) {
return redirect()->route("events.index", ['events' => $event])->with('EventNameExists', '<p><b>Der findes allerede et event med det navn!</b></p>');
} else {
if($request->file("resource")) {
$event->resource_id = ResourceController::store($request)->id;
}
$event->save();
$events = Event::query()->paginate($request->input("limit", 20));
@@ -88,6 +92,7 @@ class EventController extends Controller
'<a style="width: 33%; margin: 0; padding: 0; text-align: center; font-weight: 700;" class="sde-blue" href="'. route("events.show", ["event" => $event->id ]) .'">Læs mere</a>'.
'<a style="width: 33%; margin: 0; padding: 0; text-align: end; font-weight: 700;" class="sde-blue" href="'. route("events.accountsignups", ["event" => $event->id ]) .'">Se deltagere</a>'.
'</div>';
$news->resource_id = $event->resource_id;
$news->save();
}
@@ -79,6 +79,10 @@ class MenuPlanController extends Controller
$news->subname = "Uge " . $menuPlan->week;
$news->content = $menuPlan->menu;
if($request->file("resource")) {
$news->resource_id = ResourceController::store($request)->id;
}
$news->save();
}
+1 -1
View File
@@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model;
class News extends Model
{
protected $fillable = [
'name', 'subname', 'content'
'name', 'subname', 'content', 'resource_id'
];
}