Skip to content

Commit

Permalink
add .env.example file
Browse files Browse the repository at this point in the history
  • Loading branch information
supundulara committed Jul 2, 2024
1 parent 66dfb94 commit 89ede06
Show file tree
Hide file tree
Showing 10 changed files with 270 additions and 2 deletions.
117 changes: 117 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
APP_NAME="Laravel Boilerplate"
APP_ENV=local
APP_KEY=base64:fce65WkUOHQ9gGAmlpXgn1nY0dnZ3NVpJnELe93Lc6g=
APP_DEBUG=true
APP_URL=http://localhost

SEED_ADMIN_EMAIL=[email protected]
SEED_ADMIN_PASSWORD=admin_user

SEED_USER_EMAIL=[email protected]
SEED_USER_PASSWORD=regular_user

# Misc
APP_READ_ONLY=false
APP_READ_ONLY_LOGIN=true
DEBUGBAR_ENABLED=false
LOG_CHANNEL=daily
LOG_LEVEL=debug

# Drivers
DB_CONNECTION=mysql
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

# Database
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

# Cache
MEMCACHED_HOST=127.0.0.1

# Queue
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Mail
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

# AWS
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

# Pusher
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Application

# Access
ADMIN_REQUIRES_2FA=false
CHANGE_EMAIL=false
ENABLE_REGISTRATION=false
PASSWORD_HISTORY=3
SINGLE_LOGIN=false
PASSWORD_EXPIRES_DAYS=180

# Captcha
# Get your credentials at: https://www.google.com/recaptcha/admin
LOGIN_CAPTCHA_STATUS=false
REGISTRATION_CAPTCHA_STATUS=false
INVISIBLE_RECAPTCHA_SITEKEY=
INVISIBLE_RECAPTCHA_SECRETKEY=

# Socialite Providers
FACEBOOK_ACTIVE=false
BITBUCKET_ACTIVE=false
GITHUB_ACTIVE=false
GOOGLE_ACTIVE=false
LINKEDIN_ACTIVE=false
TWITTER_ACTIVE=false

#FACEBOOK_CLIENT_ID=
#FACEBOOK_CLIENT_SECRET=
#FACEBOOK_REDIRECT=${APP_URL}/login/facebook/callback

#BITBUCKET_CLIENT_ID=
#BITBUCKET_CLIENT_SECRET=
#BITBUCKET_REDIRECT=${APP_URL}/login/bitbucket/callback

#GITHUB_CLIENT_ID=
#GITHUB_CLIENT_SECRET=
#GITHUB_REDIRECT=${APP_URL}/login/github/callback

#GOOGLE_CLIENT_ID=
#GOOGLE_CLIENT_SECRET=
#GOOGLE_REDIRECT=${APP_URL}/login/google/callback

#LINKEDIN_CLIENT_ID=
#LINKEDIN_CLIENT_SECRET=
#LINKEDIN_REDIRECT=${APP_URL}/login/linkedin/callback

#TWITTER_CLIENT_ID=
#TWITTER_CLIENT_SECRET=
#TWITTER_REDIRECT=${APP_URL}/login/twitter/callback
4 changes: 2 additions & 2 deletions app/Domains/EventItem/Models/EventItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Domains\EventItem\Models;

use App\Domains\EventItem\Models\Traits\Scope\EventItemScope;
use Database\Factories\NewsItemFactory;
use Database\Factories\EventItemFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\Activitylog\Traits\LogsActivity;
Expand Down Expand Up @@ -59,6 +59,6 @@ public static function types()
*/
protected static function newFactory()
{
return NewsFactory::new();
return EventItemFactory::new();
}
}
40 changes: 40 additions & 0 deletions app/Http/Controllers/Backend/EventApiController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Http\Controllers\Backend;

use App\Http\Controllers\Controller;
use App\Domains\EventItem\Models\EventItem;
use Illuminate\Http\Request;
use App\Http\Resources\EventItemResource;
use App\Http\Resources\EventCollectionResource;

class EventApiController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
*/
public function index()
{
return EventCollectionResource::collection(EventItem::all());
}


/**
* Display the specified resource.
*
* @param \App\Domains\EventItem\Models\EventItem $eventItem
* @return \Illuminate\Http\JsonResponse
*/
public function show(String $id)
{
return new EventItemResource(EventItem::findOrFail($id));

}



}


29 changes: 29 additions & 0 deletions app/Http/Resources/EventCollectionResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class EventCollectionResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request)
{
return [
'id' => $this->id,
'title' => $this->title,
'description' => $this->description,
'enabled' => $this->enabled,
'link_url' => $this->link_url,
'link_caption' => $this->link_caption,
'image' => $this->image,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
29 changes: 29 additions & 0 deletions app/Http/Resources/EventItemResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class EventItemResource extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
*/
public function toArray($request):array
{
return [
'id' => $this->id,
'title' => $this->title,
'description' => $this->description,
//'enabled' => $this->enabled,
'link_url' => $this->link_url,
'link_caption' => $this->link_caption,
'image' => $this->image,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
];
}
}
23 changes: 23 additions & 0 deletions database/factories/EventItemFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Database\Factories;

use App\Domains\EventItem\Models\EventItem;
use Illuminate\Database\Eloquent\Factories\Factory;

class EventItemFactory extends Factory
{
protected $model = EventItem::class;

public function definition()
{
return [
'title' => $this->faker->sentence,
'description' => $this->faker->paragraph,
'enabled' => $this->faker->boolean,
'link_url' => $this->faker->url,
'link_caption' => $this->faker->words(3, true),
'image' => 'EventImages/' . $this->faker->image('public/storage/EventImages', 640, 480, null, false),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ public function down()
Schema::dropIfExists('event_items');
}
}


2 changes: 2 additions & 0 deletions database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public function run()

$this->call(AuthSeeder::class);
$this->call(AnnouncementSeeder::class);
$this->call(EventSeeder::class);


Model::reguard();
}
Expand Down
20 changes: 20 additions & 0 deletions database/seeders/EventSeeder.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Domains\EventItem\Models\EventItem;

class EventSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Create 10 event items using the factory
EventItem::factory()->count(10)->create();
}
}
6 changes: 6 additions & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Illuminate\Http\Request;
use App\Http\Controllers\Backend\EventApiController;

/*
|--------------------------------------------------------------------------
Expand All @@ -16,3 +17,8 @@
//Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
// return $request->user();
//});


Route::get('/event',[EventApiController::class,'index']);
Route::get('/event/{id}',[EventApiController::class,'show']);

0 comments on commit 89ede06

Please sign in to comment.