public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         Lesson::create(['title' => $faker->sentence(5), 'body' => $faker->paragraph(4), 'boolean' => $faker->boolean()]);
     }
 }
Esempio n. 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('lessons')->truncate();
     Lesson::create(['name' => 'Lesson 1', 'content' => "Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression.", 'content' => "Le Lorem Ipsum est simplement du faux texte employé dans la composition et la mise en page avant impression. Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les années 1500, quand un peintre anonyme assembla ensemble des morceaux de texte pour réaliser un livre spécimen de polices de text", 'date_start' => '2015-01-25', 'category_id' => '1', 'user_id' => '1']);
     Lesson::create(['name' => 'Lesson 2', 'content' => "Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. ", 'content' => "Il n'a pas fait que survivre cinq siècles, mais s'est aussi adapté à la bureautique informatique, sans que son contenu n'en soit modifié. Il a été popularisé dans les années 1960 grâce à la vente de feuilles Letraset contenant des passages du Lorem Ipsum, et, plus récemment, par son inclusion dans des applications de mise en page de texte, comme Aldus PageMake", 'date_start' => '2015-04-25', 'category_id' => '2', 'user_id' => '1']);
     Lesson::create(['name' => 'Lesson 3', 'content' => "On sait depuis longtemps que travailler avec du texte lisible et contenant du sens est source de distractions, et empêche de se concentrer sur la mise en page elle-même.", 'content' => "On sait depuis longtemps que travailler avec du texte lisible et contenant du sens est source de distractions, et empêche de se concentrer sur la mise en page elle-même. L'avantage du Lorem Ipsum sur un texte générique comme 'Du texte. Du texte. Du texte.' est qu'il possède une distribution de lettres plus ou moins normale, et en tout cas comparable avec celle du français standard. De nombreuses suites logicielles de mise en page ou éditeurs de sites Web ont fait", 'date_start' => '2015-07-10', 'category_id' => '3', 'user_id' => '1']);
 }
Esempio n. 3
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($idlevel, $level, $idspeciality, $speciality, $idmaterial, $material, $idlesson, $lesson)
 {
     $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get();
     $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get();
     $speciality = str_replace('-', ' ', $speciality);
     $material = str_replace('-', ' ', $material);
     $lesson = str_replace('-', ' ', $lesson);
     $lessonnames = Lesson::where('id', '=', $idlesson)->get();
     $specialitynames = Category::where('id', '=', $idspeciality)->get();
     $alllessons = Lesson::groupBy('categories_id')->orderBy('id', 'desc')->get();
     $rounds1 = Lesson::where('round', '=', '1ere-session')->get();
     $rounds2 = Lesson::where('round', '=', '2eme-session')->get();
     $fullcat = Category::get();
     $all = Category::where('parent', '=', 0);
     $level = str_replace('-', ' ', $level);
     $levelnames = Category::where('id', '=', $idlevel)->get();
     $materialnames = Category::where('id', '=', $idmaterial)->get();
     foreach ($lessonnames as $lessonname) {
         $ar_lessonname = $lessonname->ar_title;
     }
     foreach ($specialitynames as $specialityname) {
         $ar_specialityname = $specialityname->ar_name;
     }
     foreach ($levelnames as $levelname) {
         $ar_levelname = $levelname->ar_name;
     }
     foreach ($materialnames as $materialname) {
         $ar_materialname = $materialname->ar_name;
     }
     return view(proj . '.resumes', ['title' => $ar_lessonname, 'ar_materialname' => $ar_materialname, 'ar_levelname' => $ar_levelname, 'rounds1' => $rounds1, 'rounds2' => $rounds2, 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'fullcat' => $fullcat, 'idlevel' => $idlevel, 'idspeciality' => $idspeciality, 'idmaterial' => $idmaterial, 'idlesson' => $idlesson, 'level' => $level, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'alllessons' => $alllessons, 'ar_lessonname' => $ar_lessonname, 'lesson' => $lesson, 'material' => $material, 'ar_specialityname' => $ar_specialityname, 'speciality' => $speciality]);
 }
 private function makeLesson($lessonFields = [])
 {
     $lesson = array_merge(['title' => $this->fake->sentence, 'body' => $this->fake->paragraph, 'boolean' => $this->fake->boolean], $lessonFields);
     while ($this->times--) {
         Lesson::create($lesson);
     }
 }
Esempio n. 5
0
 public function list_eleve($id_lecon)
 {
     $inputs = Input::all();
     $lesson = Lesson::findOrFail($id_lecon);
     //$users = User::where('category_id',$lesson->category_id,'group_id',2)->get();
     $users = User::where('category_id', '=', $lesson->category_id)->where('group_id', '=', 2)->get();
     return view('notes.list_eleve', ['users' => $users, 'id_lecon' => $id_lecon]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // $this->call(UserTableSeeder::class);
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         Lesson::create(['title' => $faker->sentence(5), 'body' => $faker->paragraph(4), 'some_bool' => $faker->boolean()]);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $lesson = Lesson::find($id);
     if (!$lesson) {
         return $this->respondNotFound('Lesson does not exist');
     }
     return $this->respond(['data' => $this->lessonTransformer->transform($lesson)]);
 }
Esempio n. 8
0
 public function lessonGET($id)
 {
     $lesson = \App\Lesson::find($id);
     if (!$lesson) {
         return $this->respondNotFound();
     }
     return $this->respond(['data' => $this->lessonTransformer->transform($lesson)]);
 }
Esempio n. 9
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $lesson = Lesson::find($id);
     if (!$lesson) {
         return $this->responseNotFound();
     }
     return $this->response(['status' => 'success', 'data' => $this->lessonTransformer->transform($lesson)]);
 }
 public function run()
 {
     $faker = Faker::create();
     $lessonIds = Lesson::lists('id');
     $tagIds = Tag::lists('id');
     foreach (range(1, 30) as $index) {
         DB::table('lesson_tag')->insert(['lesson_id' => $faker->randomElement($lessonIds->toArray()), 'tag_id' => $faker->randomElement($tagIds->toArray())]);
     }
 }
Esempio n. 11
0
 public function lessons($domain, $courseId)
 {
     $course = Course::find($courseId);
     if (!$course) {
         return response()->json(['error' => "Môn học không tồn tại"], 404);
     }
     $lessons = Lesson::where('course_id', $courseId)->get();
     return response()->json(['course' => ['id' => $course->id, 'name' => $course->name, 'avatar_url' => $course->icon_url], 'lessons' => $lessons]);
 }
 /**
  * Updates a specific lesson in the database.
  *
  * @param int $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function update($id)
 {
     $this->checkPermissions($id);
     // Update the task with the new data
     $lesson = Lesson::findOrFail($id);
     $lesson->update(Input::all());
     // Return the updates list of tasks
     $lessons = Auth::user()->lessons;
     return View('lessons.list', compact('lessons'));
 }
Esempio n. 13
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function lesson($id_lessTyp, $id_less)
 {
     $lekcije = Lesson::where('id', $id_less)->get();
     $lista = Lesson::where('id', $id_less)->with(['user' => function ($q) {
         $q->where('users.id', Auth::user()->id);
     }])->get();
     $userId = Auth::user()->id;
     $idLe = $id_less;
     return view('lesson', compact('lekcije', 'userId', 'idLe', 'lista', 'id_lessTyp'));
 }
Esempio n. 14
0
 public static function lessons()
 {
     if (Gate::allows('view_lesson')) {
         return Lesson::all();
     } elseif (Auth::check() && Gate::allows('view_own_lesson')) {
         return Lesson::where('user_id', Auth::id())->get();
     } else {
         return null;
     }
 }
Esempio n. 15
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $lessons = \App\Lesson::all();
     foreach ($lessons as $lesson) {
         $path = base_path(\App\Lesson::$path . DIRECTORY_SEPARATOR . $lesson->name);
         $lesson->content = \File::get($path);
         $lesson->save();
         $lesson->touch();
         $this->info(sprintf('Success updating %d: %s', $lesson->id, $lesson->name));
     }
     return $this->warn('Finished.');
 }
 public function store(Request $request)
 {
     //        dd('store');
     if (!$request->input('title') or !$request->input('body')) {
         // return some kind of response
         // 400 Bad Request, 403 Forbidden, 422 Unproccesable entity
         // provide a message
         return $this->setStatusCode(422)->respondWithError('Parameters failed validation for a lesson');
     }
     Lesson::create($request->all());
     return $this->respondCreated('Lesson successfully created.');
 }
Esempio n. 17
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function home()
 {
     $all = Category::where('parent', '=', 0);
     $fullcat = Category::get();
     $allarticles = Article::orderBy('id', 'desc')->take(10)->get();
     $alllessons = Lesson::groupBy('categories_id')->orderBy('id', 'desc')->take(10)->get();
     $newsallarticles = Article::where('stat', '=', 'nouvelles')->orderBy('id', 'desc')->take(3)->get();
     $bacallarticles = Article::where('stat', '=', 'apres-bac')->orderBy('id', 'desc')->take(3)->get();
     $lessons = Lesson::all();
     $partners = Partner::all();
     return view(proj . '.home', ['title' => trans('accueil.accueil'), 'asccat' => $all->get(), 'allcat' => $all->orderBy('id', 'desc')->get(), 'fullcat' => $fullcat, 'allarticles' => $allarticles, 'newsallarticles' => $newsallarticles, 'bacallarticles' => $bacallarticles, 'partners' => $partners, 'alllessons' => $alllessons])->with('lessons', $lessons);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // $this->call(UserTableSeeder::class);
     $faker = Faker::create();
     $lessonIds = Lesson::lists('id')->all();
     // An array of ID's in that table [1, 2, 3, 4, 5, 7]
     $tagIds = Tag::lists('id')->all();
     foreach (range(1, 30) as $index) {
         // a real lesson id
         // a real tag id
         DB::table('lesson_tag')->insert(['lesson_id' => $faker->randomElement($lessonIds), 'tag_id' => $faker->randomElement($tagIds)]);
     }
 }
Esempio n. 19
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     // $lesson = Lesson::where('user_id', $request->user()->id)->get()->medias;
     if (Auth::user()->group_id != 1) {
         $lessons = Lesson::where('category_id', Auth::user()->category_id)->get();
         $infos = Info::all();
         $notes = Note::where('user_id', Auth::user()->id)->get();
     } else {
         $lessons = Lesson::all();
         $infos = Info::all();
         $notes = Note::where('user_id', Auth::user()->id)->get();
     }
     return view('home.index', compact('lessons', 'infos', 'notes'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     //a real lesson id
     //a real tag id
     $lessonIds = Lesson::get()->lists('id')->all();
     //returns an array of all lesson ids
     $tagIds = Tags::get()->lists('id')->all();
     //returns an array of all tag ids
     foreach (range(1, 30) as $index) {
         //use query builder
         DB::table('lessons_tags')->insert(['lessons_id' => $faker->randomElement($lessonIds), 'tags_id' => $faker->randomElement($tagIds)]);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param $id
  * @param CreateCommentRequest $request
  * @return \Illuminate\Http\RedirectResponse|string
  */
 public function store($id, CreateCommentRequest $request)
 {
     $lesson = Lesson::findOrFail($id);
     $comment = new Comment();
     $comment->fill($request->all());
     $comment->user_id = Auth::user()->id;
     $comment->lesson_id = $lesson->id;
     $comment->save();
     $message = trans('messages.comment_successfully_submitted');
     if ($request->ajax()) {
         return $message;
     }
     Flash::success($message);
     return redirect()->route('lessons.show', $lesson->id);
 }
Esempio n. 22
0
 public function note(Request $request, $courseSlug, $lessonSlug)
 {
     $course = Course::where('slug', $courseSlug)->firstOrFail();
     $lesson = Lesson::where('slug', $lessonSlug)->where('course_id', $course->id)->firstOrFail();
     $user = User::findOrFail($request->user_id);
     if (!Auth::user()->accompanies->contains($user)) {
         abort(403);
     }
     $note = $lesson->notes()->firstOrNew(['user_id' => $user->id, 'companion_id' => Auth::user()->id]);
     if (empty($request->message)) {
         $note->delete();
     } else {
         $note->note = $request->message;
         $note->save();
     }
     return back();
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //return $this->respondNotFound();
     //return $this->respondWithError(404,'Lesson does not exist');
     $lesson = Lesson::find($id);
     if (!$lesson) {
         /* return Response()->json([
                    'error'=>[
                    'message'=>'Lesson does not exist'
                    ]
                ],404);
            }*/
         return $this->respondNotFound('Lesson does not exist!');
         /*return Response()->json([
               'data' => $this->lessonTransformer->transform($lesson)
           ], 200);*/
     }
     return Response()->json(['data' => $this->lessonTransformer->transform($lesson)], 200);
 }
 public function store(Request $request)
 {
     $lesson = Lesson::create($request->all());
     return redirect()->route('lessons.index');
 }
Esempio n. 25
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $lessons = Lesson::all();
     $episodes = Episode::all();
     return view('episodes.index', compact('lessons', 'episodes'));
 }
Esempio n. 26
0
 /**
  * Display the specified resource.
  *
  * @param $slug
  * @return Response
  * @internal param int $id
  */
 public function show($slug)
 {
     $lesson = Lesson::where('slug', $slug)->first();
     return view('lessons.show', compact('lesson'));
 }
Esempio n. 27
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($description)
 {
     $lesson = Lesson::where('description', $description)->firstOrFail();
     return view('topic.htmls', compact('lesson'));
 }
 /**
  * Include Question
  *
  * @return League\Fractal\ItemResource
  */
 public function includeQuestions(Lesson $lesson)
 {
     $questions = $lesson->questions()->access()->get();
     return $this->collection($questions, new QuestionTransformer($this->options), 'question');
 }
Esempio n. 29
0
 public function deleteLesson($id)
 {
     $lessons = Lesson::where('id', $id)->get();
     $lesson = $lessons[0]->delete();
     return redirect('/lessonAdmin');
 }
Esempio n. 30
0
 public function create_survey_lesson(Request $request)
 {
     $survey_id = $request->survey_id;
     $lesson_id = $request->lesson_id;
     $survey = Survey::find($survey_id);
     $lesson = Lesson::find($lesson_id);
     $exist_lesson = $survey->lessons()->where('id', $lesson_id)->first();
     if ($exist_lesson == null) {
         $survey->lessons()->attach($lesson_id);
         $data = ['message' => 'Đã thêm', 'status' => 1, 'lesson' => ['course' => $lesson->course->name, 'name' => $lesson->name, 'order' => $lesson->order]];
         return response()->json($data);
     } else {
         return response()->json(['message' => 'Buổi này đã được thêm vào survey', 'status' => 0]);
     }
 }