Skip to content

Commit 5b03b0a

Browse files
committed
First Commit
0 parents  commit 5b03b0a

File tree

90 files changed

+6707
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6707
-0
lines changed

.env.example

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
APP_ENV=local
2+
APP_DEBUG=true
3+
APP_KEY=SomeRandomString
4+
5+
DB_HOST=localhost
6+
DB_DATABASE=homestead
7+
DB_USERNAME=homestead
8+
DB_PASSWORD=secret
9+
10+
CACHE_DRIVER=file
11+
SESSION_DRIVER=file
12+
QUEUE_DRIVER=sync
13+
14+
MAIL_DRIVER=smtp
15+
MAIL_HOST=mailtrap.io
16+
MAIL_PORT=2525
17+
MAIL_USERNAME=null
18+
MAIL_PASSWORD=null
19+
MAIL_ENCRYPTION=null

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.css linguist-vendored
3+
*.less linguist-vendored

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/vendor
2+
/node_modules
3+
Homestead.yaml
4+
.env

app/Article.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
use Carbon\Carbon;
7+
8+
class Article extends Model
9+
{
10+
protected $fillable = [
11+
'title',
12+
'body',
13+
'author',
14+
'user_id'
15+
];
16+
17+
public function user() {
18+
return $this->belongsTo('App\User');
19+
}
20+
//
21+
}

app/Console/Commands/Inspire.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use Illuminate\Foundation\Inspiring;
7+
8+
class Inspire extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'inspire';
16+
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Display an inspiring quote';
23+
24+
/**
25+
* Execute the console command.
26+
*
27+
* @return mixed
28+
*/
29+
public function handle()
30+
{
31+
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32+
}
33+
}

app/Console/Kernel.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Console;
4+
5+
use Illuminate\Console\Scheduling\Schedule;
6+
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
7+
8+
class Kernel extends ConsoleKernel
9+
{
10+
/**
11+
* The Artisan commands provided by your application.
12+
*
13+
* @var array
14+
*/
15+
protected $commands = [
16+
\App\Console\Commands\Inspire::class,
17+
];
18+
19+
/**
20+
* Define the application's command schedule.
21+
*
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
23+
* @return void
24+
*/
25+
protected function schedule(Schedule $schedule)
26+
{
27+
$schedule->command('inspire')
28+
->hourly();
29+
}
30+
}

app/Events/Event.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace App\Events;
4+
5+
abstract class Event
6+
{
7+
//
8+
}

app/Exceptions/Handler.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
namespace App\Exceptions;
4+
5+
use Exception;
6+
use Symfony\Component\HttpKernel\Exception\HttpException;
7+
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8+
9+
class Handler extends ExceptionHandler
10+
{
11+
/**
12+
* A list of the exception types that should not be reported.
13+
*
14+
* @var array
15+
*/
16+
protected $dontReport = [
17+
HttpException::class,
18+
];
19+
20+
/**
21+
* Report or log an exception.
22+
*
23+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
24+
*
25+
* @param \Exception $e
26+
* @return void
27+
*/
28+
public function report(Exception $e)
29+
{
30+
return parent::report($e);
31+
}
32+
33+
/**
34+
* Render an exception into an HTTP response.
35+
*
36+
* @param \Illuminate\Http\Request $request
37+
* @param \Exception $e
38+
* @return \Illuminate\Http\Response
39+
*/
40+
public function render($request, Exception $e)
41+
{
42+
return parent::render($request, $e);
43+
}
44+
}
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
7+
use App\Article;
8+
use App\Http\Requests;
9+
use App\Http\Controllers\Controller;
10+
use App\Http\Requests\ArticleRequest;
11+
12+
class ArticlesController extends Controller
13+
{
14+
15+
public function __construct()
16+
{
17+
$this->middleware('auth',['only' => 'create']);
18+
}
19+
/**
20+
* Display a listing of the resource.
21+
*
22+
* @return Response
23+
*/
24+
public function index()
25+
{
26+
$articles = Article::latest()->get();
27+
28+
return view('articles.index',compact('articles'));
29+
//
30+
}
31+
32+
/**
33+
* Show the form for creating a new resource.
34+
*
35+
* @return Response
36+
*/
37+
public function create()
38+
{
39+
//
40+
return view('articles.create');
41+
}
42+
43+
/**
44+
* Store a newly created resource in storage.
45+
*
46+
* @param Request $request
47+
* @return Response
48+
*/
49+
public function store(ArticleRequest $request)
50+
{
51+
//
52+
53+
Article::create($request->all());
54+
55+
return redirect('articles');
56+
}
57+
58+
/**
59+
* Display the specified resource.
60+
*
61+
* @param int $id
62+
* @return Response
63+
*/
64+
public function show($id)
65+
{
66+
//
67+
$article=Article::findOrFail($id);
68+
$previous = Article::where('id', '<', $article->id)->max('id');
69+
$next = Article::where('id', '>', $article->id)->min('id');
70+
$previousArticle=Article::find($previous);
71+
$nextArticle=Article::find($next);
72+
return view('articles.show',compact('article','previousArticle','nextArticle'));
73+
}
74+
75+
/**
76+
* Show the form for editing the specified resource.
77+
*
78+
* @param int $id
79+
* @return Response
80+
*/
81+
public function edit($id)
82+
{
83+
//
84+
$article=Article::findOrFail($id);
85+
return view('articles.edit',compact('article'));
86+
}
87+
88+
/**
89+
* Update the specified resource in storage.
90+
*
91+
* @param Request $request
92+
* @param int $id
93+
* @return Response
94+
*/
95+
public function update(ArticleRequest $request, $id)
96+
{
97+
//
98+
$article=Article::findOrFail($id);
99+
$article->update($request->all());
100+
101+
return redirect('articles');
102+
}
103+
104+
/**
105+
* Remove the specified resource from storage.
106+
*
107+
* @param int $id
108+
* @return Response
109+
*/
110+
public function destroy($id)
111+
{
112+
//
113+
}
114+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\User;
6+
use Validator;
7+
use App\Http\Controllers\Controller;
8+
use Illuminate\Foundation\Auth\ThrottlesLogins;
9+
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
10+
11+
class AuthController extends Controller
12+
{
13+
/*
14+
|--------------------------------------------------------------------------
15+
| Registration & Login Controller
16+
|--------------------------------------------------------------------------
17+
|
18+
| This controller handles the registration of new users, as well as the
19+
| authentication of existing users. By default, this controller uses
20+
| a simple trait to add these behaviors. Why don't you explore it?
21+
|
22+
*/
23+
protected $redirectPath = '/articles/create';
24+
protected $name='name';
25+
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
26+
27+
/**
28+
* Create a new authentication controller instance.
29+
*
30+
* @return void
31+
*/
32+
public function __construct()
33+
{
34+
$this->middleware('guest', ['except' => 'getLogout']);
35+
}
36+
37+
/**
38+
* Get a validator for an incoming registration request.
39+
*
40+
* @param array $data
41+
* @return \Illuminate\Contracts\Validation\Validator
42+
*/
43+
protected function validator(array $data)
44+
{
45+
return Validator::make($data, [
46+
'name' => 'required|max:255',
47+
'email' => 'required|email|max:255|unique:users',
48+
'password' => 'required|confirmed|min:6',
49+
]);
50+
}
51+
52+
/**
53+
* Create a new user instance after a valid registration.
54+
*
55+
* @param array $data
56+
* @return User
57+
*/
58+
protected function create(array $data)
59+
{
60+
return User::create([
61+
'name' => $data['name'],
62+
'email' => $data['email'],
63+
'password' => bcrypt($data['password']),
64+
]);
65+
}
66+
67+
public function getRegister()
68+
{
69+
return redirect('auth/login');
70+
}
71+
72+
public function postRegister()
73+
{
74+
75+
}
76+
}

0 commit comments

Comments
 (0)