<commit_before><?php

namespace App\Http\Controllers;

use App\PrayerTree;
use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use Vinkla\Hashids\Facades\Hashids;

class prayerTreeController extends AuthController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $prayerTrees = Auth::user()->prayerTrees()->get();

        if ($request->ajax()) {
            return response()->json($prayerTrees);
        }

        return view('prayertree.index', [
            'prayerTrees' => $prayerTrees
        ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     $user = Auth::user();
     */
    public function create()
    {
        return view('prayertree.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $prayerTree = new PrayerTree;
        $prayerTree->name = $request->get('name');
        $prayerTree->user_id = Auth::user()->id;
        $prayerTree->save();

        return response()->json($prayerTree);
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $prayerTree = PrayerTree::findOrFail(
            Hashids::decode($id)[0]
        );

        $prayerRequests = $prayerTree->requests()
            ->orderBy('created_at', 'desc')
            ->orderBy('approved', 'desc')
            ->get();<commit_msg>feat: Redirect after create tree<commit_after><?php

namespace App\Http\Controllers;

use App\PrayerTree;
use Illuminate\Http\Request;

use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use Vinkla\Hashids\Facades\Hashids;

class prayerTreeController extends AuthController
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        $prayerTrees = Auth::user()->prayerTrees()->get();

        if ($request->ajax()) {
            return response()->json($prayerTrees);
        }

        return view('prayertree.index', [
            'prayerTrees' => $prayerTrees
        ]);
    }

    /**
     * Show the form for creating a new resource.
     *
     $user = Auth::user();
     */
    public function create()
    {
        return view('prayertree.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        $prayerTree = new PrayerTree;
        $prayerTree->name = $request->get('name');
        $prayerTree->user_id = Auth::user()->id;
        $prayerTree->save();

        if ($request->ajax()) {
            return response()->json($prayerTree);
        }

        return redirect('/home');
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        $prayerTree = PrayerTree::findOrFail(
            Hashids::decode($id)[0]
        );

        $prayerRequests = $prayerTree->requests()
            ->orderBy('created_at', 'desc')
            ->orderBy('approved', 'desc')
            ->get();
{'fraction_non_alphanumeric': 0.1419647927314026, 'fraction_numerical': 0.0005678591709256105, 'mean_word_length': 2.112190812720848, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7580072', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1061, 'n_words': 211}