This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #10 - create models and migrations * #10 - create controller and form requests * #10 - add basic routing for Organizations * #10 - create basic CRUD views * #10 - create input error component * #10 - change route names * #10 - create CamelCaseAttributes trait * #10 - add logo for organizations * #10 - create class for Formats * #10 - fix class for Formats
- Loading branch information
1 parent
2c02a27
commit ede911f
Showing
20 changed files
with
516 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
database/migrations/2022_03_09_170615_create_organizations_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class() extends Migration { | ||
public function up(): void | ||
{ | ||
Schema::create("organizations", function (Blueprint $table): void { | ||
$table->id(); | ||
$table->string("name"); | ||
$table->text("description")->nullable(); | ||
$table->string("location"); | ||
$table->string("organization_type"); | ||
$table->dateTime("foundation_date"); | ||
$table->string("number_of_employers"); | ||
$table->string("logo"); | ||
$table->string("website_url")->nullable(); | ||
$table->string("facebook_url")->nullable(); | ||
$table->string("linkedin_url")->nullable(); | ||
$table->string("instagram_url")->nullable(); | ||
$table->string("youtube_url")->nullable(); | ||
$table->string("twitter_url")->nullable(); | ||
$table->string("github_url")->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists("organizations"); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@error($for) | ||
<div> | ||
{{ $message }} | ||
</div> | ||
@enderror |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div> | ||
<div> | ||
<h1>Create Organization</h1> | ||
@auth | ||
<form action="{{ route('organizations.store') }}" method="post" enctype="multipart/form-data"> | ||
@csrf | ||
<div> | ||
<label for="name">Name:</label> | ||
<input type="text" id="name" name="name" value="{{ old('name') }}"> | ||
<x-input-error for="name"/> | ||
</div> | ||
<div> | ||
<label for="description">Description:</label> | ||
<textarea name="description" id="description" cols="30" rows="4">{{ old('description') }}</textarea> | ||
<x-input-error for="description"/> | ||
</div> | ||
<div> | ||
<label for="location">Location:</label> | ||
<input type="text" id="location" name="location" value="{{ old('location') }}"> | ||
<x-input-error for="location"/> | ||
</div> | ||
<div> | ||
<label for="organization_type">Organization type:</label> | ||
<input type="text" id="organization_type" name="organization_type" value="{{ old('organization_type') }}"> | ||
<x-input-error for="organization_type"/> | ||
</div> | ||
<div> | ||
<label for="foundation_date">Foundation date:</label> | ||
<input type="dateTime-local" id="foundation_date" name="foundation_date" value="{{ old('foundation_date') }}"> | ||
<x-input-error for="foundation_date"/> | ||
</div> | ||
<div> | ||
<label for="number_of_employers">Number of employers:</label> | ||
<input type="text" id="number_of_employers" name="number_of_employers" value="{{ old('number_of_employers') }}"> | ||
<x-input-error for="number_of_employers"/> | ||
</div> | ||
<div> | ||
<label for="logo">Logo image:</label> | ||
<input type="file" id="logo" name="logo"> | ||
<x-input-error for="logo"/> | ||
</div> | ||
<div> | ||
<label for="website_url">Website:</label> | ||
<input type="text" id="website_url" name="website_url" value="{{ old('website_url') }}"> | ||
<x-input-error for="website_url"/> | ||
</div> | ||
<div> | ||
<label for="facebook_url">Facebook:</label> | ||
<input type="text" id="facebook_url" name="facebook_url" value="{{ old('facebook_url') }}"> | ||
<x-input-error for="facebook_url"/> | ||
</div> | ||
<div> | ||
<label for="linkedin_url">Linkedin:</label> | ||
<input type="text" id="linkedin_url" name="linkedin_url" value="{{ old('linkedin_url') }}"> | ||
<x-input-error for="linkedin_url"/> | ||
</div> | ||
<div> | ||
<label for="instagram_url">Instagram:</label> | ||
<input type="text" id="instagram_url" name="instagram_url" value="{{ old('instagram_url') }}"> | ||
<x-input-error for="instagram_url"/> | ||
</div> | ||
<div> | ||
<label for="youtube_url">YouTube:</label> | ||
<input type="text" id="youtube_url" name="youtube_url" value="{{ old('youtube_url') }}"> | ||
<x-input-error for="youtube_url"/> | ||
</div> | ||
<div> | ||
<label for="twitter_url">Twitter:</label> | ||
<input type="text" id="twitter_url" name="twitter_url" value="{{ old('twitter_url') }}"> | ||
<x-input-error for="twitter_url"/> | ||
</div> | ||
<div> | ||
<label for="github_url">Github:</label> | ||
<input type="text" id="github_url" name="github_url" value="{{ old('github_url') }}"> | ||
<x-input-error for="github_url"/> | ||
</div> | ||
<div> | ||
<button type="submit">Create</button> | ||
</div> | ||
</form> | ||
@endauth | ||
</div> | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div> | ||
<div> | ||
<h1>Edit Organization</h1> | ||
@auth | ||
<form method="post" action="{{ route('organizations.update', $organization) }}" enctype="multipart/form-data"> | ||
@method('PUT') | ||
@csrf | ||
<div> | ||
<label for="name">Name:</label> | ||
<input type="text" id="name" name="name" value="{{ old('name', $organization->name) }}"> | ||
<x-input-error for="name"/> | ||
</div> | ||
<div> | ||
<label for="description">Description:</label> | ||
<textarea name="description" id="description" cols="30" rows="4">{{ old('description', $organization->description) }}</textarea> | ||
<x-input-error for="description"/> | ||
</div> | ||
<div> | ||
<label for="location">Location:</label> | ||
<input type="text" id="location" name="location" value="{{ old('location', $organization->location) }}"> | ||
<x-input-error for="location"/> | ||
</div> | ||
<div> | ||
<label for="organization_type">Organization type:</label> | ||
<input type="text" id="organization_type" name="organization_type" value="{{ old('organization_type', $organization->organizationType) }}"> | ||
<x-input-error for="organization_type"/> | ||
</div> | ||
<div> | ||
<label for="foundation_date">Foundation date:</label> | ||
<input type="dateTime-local" id="foundation_date" name="foundation_date" value="{{ old('foundation_date', $organization->foundationDate) }}"> | ||
<x-input-error for="foundation_date"/> | ||
</div> | ||
<div> | ||
<label for="number_of_employers">Number of employers:</label> | ||
<input type="text" id="number_of_employers" name="number_of_employers" value="{{ old('number_of_employers', $organization->numberOfEmployers) }}"> | ||
<x-input-error for="number_of_employers"/> | ||
</div> | ||
<div> | ||
<label for="logo">Logo image:</label> | ||
<input type="file" id="logo" name="logo"> | ||
<x-input-error for="logo"/> | ||
</div> | ||
<div> | ||
<label for="website_url">Website:</label> | ||
<input type="text" id="website_url" name="website_url" value="{{ old('website_url', $organization->websiteUrl) }}"> | ||
<x-input-error for="website_url"/> | ||
</div> | ||
<div> | ||
<label for="facebook_url">Facebook:</label> | ||
<input type="text" id="facebook_url" name="facebook_url" value="{{ old('facebook_url', $organization->facebookUrl) }}"> | ||
<x-input-error for="website_url"/> | ||
</div> | ||
<div> | ||
<label for="linkedin_url">Linkedin:</label> | ||
<input type="text" id="linkedin_url" name="linkedin_url" value="{{ old('linkedin_url', $organization->linkedinUrl) }}"> | ||
<x-input-error for="linkedin_url"/> | ||
</div> | ||
<div> | ||
<label for="instagram_url">Instagram:</label> | ||
<input type="text" id="instagram_url" name="instagram_url" value="{{ old('instagram_url', $organization->instagramUrl) }}"> | ||
<x-input-error for="instagram_url"/> | ||
</div> | ||
<div> | ||
<label for="youtube_url">YouTube:</label> | ||
<input type="text" id="youtube_url" name="youtube_url" value="{{ old('youtube_url', $organization->youtubeUrl) }}"> | ||
<x-input-error for="youtube_url"/> | ||
</div> | ||
<div> | ||
<label for="twitter_url">Twitter:</label> | ||
<input type="text" id="twitter_url" name="twitter_url" value="{{ old('twitter_url', $organization->twitterUrl) }}"> | ||
<x-input-error for="twitter_url"/> | ||
</div> | ||
<div> | ||
<label for="github_url">Github:</label> | ||
<input type="text" id="github_url" name="github_url" value="{{ old('github_url', $organization->githubUrl) }}"> | ||
<x-input-error for="github_url"/> | ||
</div> | ||
<div> | ||
<button type="submit">Update</button> | ||
</div> | ||
</form> | ||
@endauth | ||
</div> | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@extends('layouts.app') | ||
|
||
@section('content') | ||
<div> | ||
<div> | ||
<h1>Organizations</h1> | ||
@auth | ||
<a href="{{ route('organizations.create') }}">Create new organization</a> | ||
@endauth | ||
@if ($organizations->count()) | ||
@foreach ($organizations as $organization) | ||
<div> | ||
{{ $organization->name }} | ||
{{ $organization->location }} | ||
{{ $organization->organizationType }} | ||
{{ $organization->numberOfEmployers }} | ||
<a href="{{ $organization->websiteUrl }}"> Website </a> | ||
|
||
<a href="{{ route('organizations.edit', $organization) }}">Edit</a> | ||
<form action="{{ route('organizations.destroy', $organization) }}" method="post"> | ||
@csrf | ||
@method('DELETE') | ||
<button type="submit">Delete</button> | ||
</form> | ||
</div> | ||
@endforeach | ||
|
||
{{ $organizations->links() }} | ||
@else | ||
<p>There are no organizations</p> | ||
@endif | ||
</div> | ||
</div> | ||
@endsection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Blumilk\Meetup\Core; | ||
|
||
class Formats | ||
{ | ||
public const DATETIME = "Y-m-d h:i:s"; | ||
} |
Oops, something went wrong.