Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = new User();
     $user->name = 'hisyam';
     $user->email = '*****@*****.**';
     //$user->photo = 'southern_miss_logo.0.0.jpeg';
     $user->password = bcrypt('admin1');
     $user->save();
     $stat = Stat::create(['user_id' => '1', 'content' => 'Lorem Ipsum', 'published_at' => Carbon\Carbon::now()]);
     $like = Like::create(['stat_id' => '1', 'count' => 45]);
     $comment = Comment::create(['stat_id' => 1, 'user_id' => 1, 'content' => 'Lorem Ipsum', 'published_at' => Carbon\Carbon::now()]);
 }
Пример #2
0
 public function store(Request $request)
 {
     $text = $request->input('text');
     $messages = ['in' => "ค่า Happy มีค่าระหว่าง 1 - 3 นะครับ", 'required' => "อย่าลืมส่งค่า Happy มาด้วยนะครับ เช่น /Happytime 3"];
     $validator = \Validator::make(['text' => $text], ['text' => 'required|in:1,2,3,list'], $messages);
     if (!$validator->fails()) {
         if ($text == 'list') {
             $response = Stat::ListSenderToday()->lists('user_name');
         } else {
             if (Stat::isTodaySend($request->input('user_id'))) {
                 $response = "วันนี้คุณส่ง happytime ไปแล้วนะครับ";
             } else {
                 Stat::create($request->all());
                 $response = 'บันทึกเรียบร้อยครับ';
             }
         }
     } else {
         $response = $validator->errors()->first();
     }
     return $response;
 }